Skip to content

Commit b442d01

Browse files
committed
Specify X509KeyStorageFlags. Fixes #574
1 parent 2a3948f commit b442d01

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ private async Task InitSslAsync(ProtocolCapabilities serverCapabilities, Connect
947947
{
948948
try
949949
{
950-
var certificate = new X509Certificate2(cs.CertificateFile, cs.CertificatePassword);
950+
var certificate = new X509Certificate2(cs.CertificateFile, cs.CertificatePassword, X509KeyStorageFlags.MachineKeySet);
951951
if (!certificate.HasPrivateKey)
952952
{
953953
m_logArguments[1] = cs.CertificateFile;
@@ -1005,7 +1005,7 @@ private async Task InitSslAsync(ProtocolCapabilities serverCapabilities, Connect
10051005
// load the certificate at this index; note that 'new X509Certificate' stops at the end of the first certificate it loads
10061006
m_logArguments[1] = index;
10071007
Log.Debug("Session{0} loading certificate at Index {1} in the CA certificate file.", m_logArguments);
1008-
var caCertificate = new X509Certificate2(Utility.ArraySlice(certificateBytes, index, (nextIndex == -1 ? certificateBytes.Length : nextIndex) - index));
1008+
var caCertificate = new X509Certificate2(Utility.ArraySlice(certificateBytes, index, (nextIndex == -1 ? certificateBytes.Length : nextIndex) - index), default(string), X509KeyStorageFlags.MachineKeySet);
10091009
certificateChain.ChainPolicy.ExtraStore.Add(caCertificate);
10101010
}
10111011
catch (CryptographicException ex)

0 commit comments

Comments
 (0)