Skip to content

Commit bc78fae

Browse files
committed
macOS issue when handling a certificate without a private key.
Eliminating possibility of a certificate with a private key having been previously added to the user certificate store.
1 parent c199ddd commit bc78fae

File tree

1 file changed

+3
-2
lines changed
  • src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests

1 file changed

+3
-2
lines changed

src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/Utility.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,11 @@ internal static X509Certificate2 CreateCertificateWithNoPrivateKey()
363363
{
364364
certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
365365
certStore.Open(OpenFlags.ReadWrite);
366-
if (!certStore.Certificates.Contains(publicKey))
366+
if (certStore.Certificates.Contains(publicKey))
367367
{
368-
certStore.Add(publicKey);
368+
certStore.Remove(publicKey);
369369
}
370+
certStore.Add(publicKey);
370371
}
371372
finally
372373
{

0 commit comments

Comments
 (0)