Class CertificateManager
Inherited Members
Namespace: Coree.NETASP.Services.CertificateManager
Assembly: Coree.NETASP.dll
Syntax
public static class CertificateManager
Methods
| Edit this page View SourceGenerateAndOrLoadSelfSignedCertificate(string, string[], int, string, string, string)
Generates or loads a self-signed X509 certificate.
Declaration
public static X509Certificate2 GenerateAndOrLoadSelfSignedCertificate(string subjectName, string[] sanNames, int validityPeriodYears, string password, string fileName, string path)
Parameters
Type | Name | Description |
---|---|---|
string | subjectName | The subject name for the certificate, typically a DNS name. |
string[] | sanNames | |
int | validityPeriodYears | The number of years the certificate will remain valid. |
string | password | The password used to encrypt the PFX file. |
string | fileName | The file name for the certificate PFX file. |
string | path |
Returns
Type | Description |
---|---|
X509Certificate2 | An X509Certificate2 containing both the public key and associated private key. |
Remarks
This method checks for an existing certificate file and loads it if valid. If no valid certificate is found, a new one is generated.
GenerateSelfSignedCertificate2(string, string[], int, string)
Declaration
public static X509Certificate2 GenerateSelfSignedCertificate2(string subjectName, string[] sanNames, int validityPeriodYears, string password)
Parameters
Type | Name | Description |
---|---|---|
string | subjectName | |
string[] | sanNames | |
int | validityPeriodYears | |
string | password |
Returns
Type | Description |
---|---|
X509Certificate2 |