Class CachedCertificateLoader
The cached certificate loader loads X.509 certificates.
Certificates are cached in memory for performance.
Inheritance
Inherited Members
Namespace: ComponentSpace.SAML2.Certificates
Assembly: ComponentSpace.Saml2.dll
Syntax
public class CachedCertificateLoader : ICachedCertificateLoader, ICertificateLoader
Constructors
CachedCertificateLoader(ICertificateLoader)
Constructs a CachedCertificateLoader.
Declaration
public CachedCertificateLoader(ICertificateLoader certificateLoader)
Parameters
Type | Name | Description |
---|---|---|
ICertificateLoader | certificateLoader | The certificate loader. |
Properties
KeyStorageFlags
Gets or sets the key storage flags to use when loading X.509 certificates.
Declaration
public virtual X509KeyStorageFlags KeyStorageFlags { get; set; }
Property Value
Type | Description |
---|---|
System.Security.Cryptography.X509Certificates.X509KeyStorageFlags | The key storage flags to use when loading X.509 certificates. |
Methods
Clear()
Removes all X.509 certificates from the cache.
Declaration
public virtual void Clear()
Exceptions
Type | Condition |
---|---|
SAMLException | Thrown when the X.509 certificate cache cannot be cleared. |
LoadCertificateFromFile(String, String)
Loads an X.509 certificate from the file system.
Certificates are cached in memory for performance.
Declaration
public virtual X509Certificate2 LoadCertificateFromFile(string certificateFile, string certificatePassword)
Parameters
Type | Name | Description |
---|---|---|
System.String | certificateFile | The certificate file name. |
System.String | certificatePassword | The certificate file password or |
Returns
Type | Description |
---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | The X.509 certificate. |
Exceptions
Type | Condition |
---|---|
SAMLException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificateFromKey(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 X509Certificate2 LoadCertificateFromKey(string certificateKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | certificateKey | The configuration key. |
Returns
Type | Description |
---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | The X.509 certificate. |
Exceptions
Type | Condition |
---|---|
SAMLException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificateFromStore(StoreLocation, String, X509FindType, Object)
Loads an X.509 certificate from the Windows Certificate Store.
Certificates are cached in memory for performance.
Declaration
public virtual X509Certificate2 LoadCertificateFromStore(StoreLocation storeLocation, string storeName, X509FindType findType, object findValue)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.X509Certificates.StoreLocation | storeLocation | The store location. |
System.String | storeName | The store name. |
System.Security.Cryptography.X509Certificates.X509FindType | findType | The find type for searching the certificate store. |
System.Object | findValue | The find value for searching the certificate store. |
Returns
Type | Description |
---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | The X.509 certificate. |
Exceptions
Type | Condition |
---|---|
SAMLException | Thrown when the X.509 certificates cannot be loaded. |
LoadCertificateFromString(String, String)
Loads an X.509 certificate from a base-64 encoded string.
Declaration
public virtual X509Certificate2 LoadCertificateFromString(string certificateString, string certificatePassword)
Parameters
Type | Name | Description |
---|---|---|
System.String | certificateString | The certificate base-64 encoded string. |
System.String | certificatePassword | The certificate file password or |
Returns
Type | Description |
---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 | The X.509 certificate. |
Exceptions
Type | Condition |
---|---|
SAMLException | Thrown when the X.509 certificates cannot be loaded. |