Visual Basic (Usage) | ![]() |
---|---|
Dim storeType As String Dim storePath As String Dim applicationUri As String Dim applicationName As String Dim subjectName As String Dim domainNames As IList(Of String) Dim keySize As UShort Dim lifetimeInMonths As UShort Dim value As X509Certificate2 value = CertificateFactory.CreateCertificate(storeType, storePath, applicationUri, applicationName, subjectName, domainNames, keySize, lifetimeInMonths) |
C# | |
---|---|
public static X509Certificate2 CreateCertificate( string storeType, string storePath, string applicationUri, string applicationName, string subjectName, IList<string> domainNames, ushort keySize, ushort lifetimeInMonths ) |
Parameters
- storeType
- Type of certificate store (Windows or Directory) CertificateStoreType.
- storePath
- The store path (syntax depends on storeType).
- applicationUri
- The application uri (created if not specified).
- applicationName
- Name of the application (optional if subjectName is specified).
- subjectName
- The subject used to create the certificate (optional if applicationName is specified).
- domainNames
- The domain names that can be used to access the server machine (defaults to local computer name if not specified).
- keySize
- Size of the key (1024, 2048 or 4096).
- lifetimeInMonths
- The lifetime of the key in months.
Return Value
The certificate with a private key.Target Platforms: Windows 7/8/10, Windows Server 2003/2008/2012/2015, .NET4.x