Class CertificateHelper
Provides helper methods for X.509 certificates.
Inheritance
System.Object
CertificateHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ComponentSpace.SAML2.Utility
Assembly: ComponentSpace.Saml2.dll
Syntax
public static class CertificateHelper
Methods
GetPrivateKey(X509Certificate2)
Gets the private key from the certificate using the most appropriate method.
Declaration
public static AsymmetricAlgorithm GetPrivateKey(X509Certificate2 x509Certificate)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | x509Certificate | The certificate. |
Returns
Type | Description |
---|---|
System.Security.Cryptography.AsymmetricAlgorithm | The private key. |
Exceptions
Type | Condition |
---|---|
SAMLCertificateException | Thrown when there's no private asymmetric key. |
GetPublicKey(X509Certificate2)
Gets the public key from the certificate using the most appropriate method.
Declaration
public static AsymmetricAlgorithm GetPublicKey(X509Certificate2 x509Certificate)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | x509Certificate | The certificate. |
Returns
Type | Description |
---|---|
System.Security.Cryptography.AsymmetricAlgorithm | The public key. |
Exceptions
Type | Condition |
---|---|
SAMLCertificateException | Thrown when there's no public asymmetric key. |