Class CertificateLoader
The certificate loader loads X.509 certificates.
Implements
Inherited Members
Namespace: ComponentSpace.OpenID.Certificates
Assembly: ComponentSpace.OpenID.dll
Syntax
public class CertificateLoader : ICertificateLoader
Constructors
CertificateLoader(IConfiguration, IEnumerable<ICertificateValidator>, ILoggerFactory)
Initializes a new instance of the CertificateLoader class.
Declaration
public CertificateLoader(IConfiguration configuration, IEnumerable<ICertificateValidator> certificateValidators, ILoggerFactory loggerFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration | configuration | The configuration. |
| IEnumerable<ICertificateValidator> | certificateValidators | The certificate validators. |
| ILoggerFactory | loggerFactory | The logger factory. |
Methods
LoadCertificateAsync(Certificate)
Loads the X.509 signature certificate.
Declaration
public virtual Task<X509Certificate2> LoadCertificateAsync(Certificate certificate)
Parameters
| Type | Name | Description |
|---|---|---|
| Certificate | certificate | The certificate configuration. |
Returns
| Type | Description |
|---|---|
| Task<X509Certificate2> | A task that represents the operation and returns the X.509 certificate. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the X.509 certificate cannot be loaded. |
LoadCertificateFromBytesAsync(byte[], string?)
Loads an X.509 certificate from a byte array.
Declaration
public virtual Task<X509Certificate2> LoadCertificateFromBytesAsync(byte[] certificateBytes, string? certificatePassword = null)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | certificateBytes | The certificate bytes. |
| string | certificatePassword | The certificate password or |
Returns
| Type | Description |
|---|---|
| Task<X509Certificate2> | A task that represents the operation and returns the X.509 certificate. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificateFromFileAsync(string, string?)
Loads an X.509 certificate from the file system.
Declaration
public virtual Task<X509Certificate2> LoadCertificateFromFileAsync(string certificateFile, string? certificatePassword = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | certificateFile | The certificate file name. |
| string | certificatePassword | The certificate file password or |
Returns
| Type | Description |
|---|---|
| Task<X509Certificate2> | A task that represents the operation and returns the X.509 certificate. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificateFromKeyAsync(string)
Loads an X.509 certificate from elsewhere in the configuration.
This may be used to retrieve certificates stored in an Azure key vault.
Declaration
public virtual Task<X509Certificate2> LoadCertificateFromKeyAsync(string certificateKey)
Parameters
| Type | Name | Description |
|---|---|---|
| string | certificateKey | The configuration key. |
Returns
| Type | Description |
|---|---|
| Task<X509Certificate2> | A task that represents the operation and returns the X.509 certificate. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificateFromStoreAsync(string, StoreLocation, X509FindType, object)
Loads an X.509 certificate from the Windows Certificate Store.
Declaration
public virtual Task<X509Certificate2> LoadCertificateFromStoreAsync(string storeName, StoreLocation storeLocation, X509FindType findType, object findValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | storeName | The store name. |
| StoreLocation | storeLocation | The store location. |
| X509FindType | findType | The find type for searching the certificate store. |
| object | findValue | The find value for searching the certificate store. |
Returns
| Type | Description |
|---|---|
| Task<X509Certificate2> | A task that represents the operation and returns the X.509 certificate. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificateFromStringAsync(string, string?)
Loads an X.509 certificate from a base-64 encoded string.
Declaration
public virtual Task<X509Certificate2> LoadCertificateFromStringAsync(string certificateString, string? certificatePassword = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | certificateString | The certificate base-64 encoded string. |
| string | certificatePassword | The certificate password or |
Returns
| Type | Description |
|---|---|
| Task<X509Certificate2> | A task that represents the operation and returns the X.509 certificate. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificatesAsync(IEnumerable<Certificate>)
Loads the X.509 signature certificates.
Declaration
public virtual Task<IList<X509Certificate2>> LoadCertificatesAsync(IEnumerable<Certificate> certificates)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Certificate> | certificates | The certificate configurations. |
Returns
| Type | Description |
|---|---|
| Task<IList<X509Certificate2>> | A task that represents the operation and returns the X.509 certificates. |
Exceptions
| Type | Condition |
|---|---|
| OpenIDException | Thrown when the X.509 certificates cannot be loaded. |