1
- using System ;
2
- using System . Collections . Generic ;
1
+ using System . Collections . Generic ;
3
2
using System . IO ;
4
3
using System . Runtime . InteropServices ;
5
- using System . Security . Cryptography ;
6
- using System . Security . Cryptography . X509Certificates ;
7
4
using MySql . Data . MySqlClient ;
8
5
9
6
namespace MySql . Data . Serialization
@@ -34,19 +31,8 @@ public ConnectionSettings(MySqlConnectionStringBuilder csb)
34
31
35
32
// SSL/TLS Options
36
33
SslMode = csb . SslMode ;
37
- if ( SslMode != MySqlSslMode . None )
38
- {
39
- try
40
- {
41
- Certificate = new X509Certificate2 ( csb . CertificateFile , csb . CertificatePassword ) ;
42
- }
43
- catch ( CryptographicException ex )
44
- {
45
- if ( ! File . Exists ( csb . CertificateFile ) )
46
- throw new MySqlException ( "Cannot find SSL Certificate File" , ex ) ;
47
- throw new MySqlException ( "Either the SSL Certificate Password is incorrect or the SSL Certificate File is invalid" , ex ) ;
48
- }
49
- }
34
+ CertificateFile = csb . CertificateFile ;
35
+ CertificatePassword = csb . CertificatePassword ;
50
36
51
37
// Connection Pooling Options
52
38
Pooling = csb . Pooling ;
@@ -83,7 +69,8 @@ private ConnectionSettings(ConnectionSettings other, bool? useCompression)
83
69
84
70
// SSL/TLS Options
85
71
SslMode = other . SslMode ;
86
- Certificate = other . Certificate ;
72
+ CertificateFile = other . CertificateFile ;
73
+ CertificatePassword = other . CertificatePassword ;
87
74
88
75
// Connection Pooling Options
89
76
Pooling = other . Pooling ;
@@ -114,7 +101,8 @@ private ConnectionSettings(ConnectionSettings other, bool? useCompression)
114
101
115
102
// SSL/TLS Options
116
103
internal readonly MySqlSslMode SslMode ;
117
- internal readonly X509Certificate2 Certificate ;
104
+ internal readonly string CertificateFile ;
105
+ internal readonly string CertificatePassword ;
118
106
119
107
// Connection Pooling Options
120
108
internal readonly bool Pooling ;
@@ -134,3 +122,4 @@ private ConnectionSettings(ConnectionSettings other, bool? useCompression)
134
122
}
135
123
136
124
}
125
+
0 commit comments