Skip to content

Commit

Permalink
Verify handle when adding certificate
Browse files Browse the repository at this point in the history
Make sure we verify that a certificate's handle is valid before adding it to the store.

Fix #12223
  • Loading branch information
Jonathan Mezach committed Apr 11, 2017
1 parent facaacf commit a67ff19
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public void Add(X509Certificate2 certificate)
{
if (certificate == null)
throw new ArgumentNullException(nameof(certificate));

if (certificate.Handle == IntPtr.Zero)
throw new ArgumentNullException(nameof(certificate));

if (_storePal == null)
throw new CryptographicException(SR.Cryptography_X509_StoreNotOpen);
Expand Down

0 comments on commit a67ff19

Please sign in to comment.