From ca5e3e835feff5836a06aff511acf7080ce76f49 Mon Sep 17 00:00:00 2001 From: Javad Date: Fri, 9 Feb 2024 20:17:21 -0800 Subject: [PATCH] Removing DSA public key from SqlColumnEncryptionProvider to address CodeQL flags. (#2347) --- ...EncryptionCertificateStoreProvider.Windows.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Windows.cs index d644acbea7..0036fca41e 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Windows.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Windows.cs @@ -81,13 +81,7 @@ public override byte[] DecryptColumnEncryptionKey(string masterKeyPath, string e X509Certificate2 certificate = GetCertificateByPath(masterKeyPath, isSystemOp: true); RSA RSAPublicKey = certificate.GetRSAPublicKey(); - int keySizeInBytes; -#if NETCOREAPP || NETSTANDARD2_1 - DSA DSAPublicKey = certificate.GetDSAPublicKey(); - keySizeInBytes = RSAPublicKey is not null ? RSAPublicKey.KeySize / 8 : DSAPublicKey.KeySize / 8; -#else - keySizeInBytes= RSAPublicKey.KeySize / 8; -#endif + int keySizeInBytes= RSAPublicKey.KeySize / 8; // Validate and decrypt the EncryptedColumnEncryptionKey // Format is @@ -182,13 +176,7 @@ public override byte[] EncryptColumnEncryptionKey(string masterKeyPath, string e X509Certificate2 certificate = GetCertificateByPath(masterKeyPath, isSystemOp: false); RSA RSAPublicKey = certificate.GetRSAPublicKey(); - int keySizeInBytes; -#if NETCOREAPP || NETSTANDARD2_1 - DSA DSAPublicKey = certificate.GetDSAPublicKey(); - keySizeInBytes = RSAPublicKey is not null ? RSAPublicKey.KeySize / 8 : DSAPublicKey.KeySize / 8; -#else - keySizeInBytes= RSAPublicKey.KeySize / 8; -#endif + int keySizeInBytes= RSAPublicKey.KeySize / 8; // Construct the encryptedColumnEncryptionKey // Format is