Skip to content

dina-heidar/x509-certificates-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nuget Installation

Link to Nuget page

PM> Install-Package Cryptography.X509Certificates.Extension

To Use:

To only retrieve a valid matching certificate from the certificate store:

X509Certificate2 cert = new Cryptography.X509Certificates.Extension.X509Certificate2(
                "1E0001122AA33324CFE608FC2200000001122A",
                StoreName.My,
                StoreLocation.LocalMachine,
                X509FindType.FindBySerialNumber);

To only retrieve ANY (does not have to be valid one) matching certificate from the certificate store:

X509Certificate2 cert = new Cryptography.X509Certificates.Extension.X509Certificate2(
                "1E0001122AA33324CFE608FC2200000001122A",
                StoreName.My,
                StoreLocation.LocalMachine,
                X509FindType.FindBySerialNumber,
                false);

To only retrieve a valid matching certificate from the certificate store that does not have a private key:

X509Certificate2 cert = new Cryptography.X509Certificates.Extension.X509Certificate2(
                "1E0001122AA33324CFE608FC2200000001122A",
                StoreName.My,
                StoreLocation.LocalMachine,
                X509FindType.FindBySerialNumber,
                true, 
                false);

About

X509Certificate2 extension to search for a X509Certificate2 in server/computer certificate store. Ideal to use when in production mode on servers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages