diff --git a/PluginVersion.txt b/PluginVersion.txt index a6454c1..5df52fd 100644 --- a/PluginVersion.txt +++ b/PluginVersion.txt @@ -1,3 +1,3 @@ : -SmartCertificateKeyProviderPlugin:2.0.1 +SmartCertificateKeyProviderPlugin:2.0.2 : diff --git a/Source/SmartCertificateKeyProvider.cs b/Source/SmartCertificateKeyProvider.cs index 8e37562..db8b587 100644 --- a/Source/SmartCertificateKeyProvider.cs +++ b/Source/SmartCertificateKeyProvider.cs @@ -109,12 +109,12 @@ public override byte[] GetKey(KeyProviderQueryContext keyProviderQueryContext) { try { - if (certificate.PrivateKey is RSA rsa) + using (RSACng rsaCng = certificate.GetRSAPrivateKey() as RSACng) { CertificateCache.StoreCachedValue(keyProviderQueryContext.DatabasePath, certificate.Thumbprint); // Using HashAlgorithmName.SHA1 for backward compatibility - return rsa.SignData(DataToSign, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); // DO NOT CHANGE THIS!!!!; + return rsaCng.SignData(DataToSign, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); // DO NOT CHANGE THIS!!!!; } } catch (Exception ex)