[]
The security utility class.
public static class SecurityUtils
Builds the chain of certificates from a byte array.
public static X509Certificate2[] GetCertificateChain(byte[] rawData, string password, X509RevocationMode revocationMode = X509RevocationMode.NoCheck, X509VerificationFlags verificationFlags = X509VerificationFlags.AllFlags)
rawData byte[]The byte array containing data in PFX or P12 format.
password stringThe password to use.
revocationMode System.Security.Cryptography.X509Certificates.X509RevocationModeThe revocation mode used to build the X509Chain.
verificationFlags System.Security.Cryptography.X509Certificates.X509VerificationFlagsThe verification flags used to build the X509Chain.
The chain of certificates. The first element is the signing certificate, the last element is the certificate of CA.
Builds the chain of certificates from a specified file.
public static X509Certificate2[] GetCertificateChain(string fileName, string password, X509RevocationMode revocationMode = X509RevocationMode.NoCheck, X509VerificationFlags verificationFlags = X509VerificationFlags.AllFlags)
fileName stringThe name of a .pfx or a .p12 file.
password stringThe password to use.
revocationMode System.Security.Cryptography.X509Certificates.X509RevocationModeThe revocation mode used to build the X509Chain.
verificationFlags System.Security.Cryptography.X509Certificates.X509VerificationFlagsThe verification flags used to build the X509Chain.
The chain of certificates. The first element is the signing certificate, the last element is the certificate of CA.
Downloads the CRL from a specified URL.
public static byte[] GetCRL(Uri uri)
uri System.UriThe target URL.
The CRL or null if the CRL could not be obtained from the specified URL.
Returns the URL of the Certificate Revocation List(CRL) for a certificate.
public static string GetCRLURL(X509Certificate2 certificate)
certificate System.Security.Cryptography.X509Certificates.X509Certificate2Returns the OCSP for specified certificate.
public static byte[] GetOCSP(X509Certificate2 certificate, X509Certificate2 parentCertificate, string url)
certificate System.Security.Cryptography.X509Certificates.X509Certificate2The certificate to check.
parentCertificate System.Security.Cryptography.X509Certificates.X509Certificate2The parent certificate.
url stringThe OCSP URL, can be null, in this case it will be obtained from certificate if possible.
Returns the OCSP URL from the certificate.
public static string GetOCSPURL(X509Certificate2 certificate)
certificate System.Security.Cryptography.X509Certificates.X509Certificate2