C# Class Opc.Ua.CertificateFactory

Creates a manages certificates.
ファイルを表示 Open project: OPCFoundation/UA-.NETStandardLibrary Class Usage Examples

Public Methods

Method Description
Create ( byte encodedData, bool useCache ) : X509Certificate2

Creates a certificate from a buffer with DER encoded certificate.

CreateCertificate ( string storeType, string storePath, string applicationUri, string applicationName, string subjectName = null, IList serverDomainNames = null, ushort keySize = defaultKeySize, ushort lifetimeInMonths = defaultLifeTime, ushort hashSizeInBits = defaultHashSize ) : X509Certificate2

Creates a self signed application instance certificate.

CreateCertificate ( string storeType, string storePath, string password, string applicationUri, string applicationName, string subjectName, IList domainNames, ushort keySize, DateTime startTime, ushort lifetimeInMonths, ushort hashSizeInBits, bool isCA, X509Certificate2 issuerCAKeyCert ) : X509Certificate2

Creates a self signed application instance certificate.

CreateCertificateFromPKCS12 ( byte rawData, string password ) : X509Certificate2

Creates a certificate from a PKCS #12 store with a private key.

Load ( X509Certificate2 certificate, bool ensurePrivateKeyAccessible ) : X509Certificate2

Loads the cached version of a certificate.

This function is necessary because all private keys used for cryptography operations must be in a key conatiner. Private keys stored in a PFX file have no key conatiner by default.

Private Methods

Method Description
SetSuitableDefaults ( string &applicationUri, string &applicationName, string &subjectName, IList &domainNames, ushort &keySize, ushort &lifetimeInMonths, bool isCA ) : void

Sets the parameters to suitable defaults.

Method Details

Create() public static method

Creates a certificate from a buffer with DER encoded certificate.
public static Create ( byte encodedData, bool useCache ) : X509Certificate2
encodedData byte The encoded data.
useCache bool if set to true the copy of the certificate in the cache is used.
return System.Security.Cryptography.X509Certificates.X509Certificate2

CreateCertificate() public static method

Creates a self signed application instance certificate.
public static CreateCertificate ( string storeType, string storePath, string applicationUri, string applicationName, string subjectName = null, IList serverDomainNames = null, ushort keySize = defaultKeySize, ushort lifetimeInMonths = defaultLifeTime, ushort hashSizeInBits = defaultHashSize ) : X509Certificate2
storeType string Type of certificate store (Directory) .
storePath string The store path (syntax depends on storeType).
applicationUri string The application uri (created if not specified).
applicationName string Name of the application (optional if subjectName is specified).
subjectName string The subject used to create the certificate (optional if applicationName is specified).
serverDomainNames IList
keySize ushort Size of the key (1024, 2048 or 4096).
lifetimeInMonths ushort The lifetime of the key in months.
hashSizeInBits ushort The hash size in bits.
return X509Certificate2

CreateCertificate() public static method

Creates a self signed application instance certificate.
public static CreateCertificate ( string storeType, string storePath, string password, string applicationUri, string applicationName, string subjectName, IList domainNames, ushort keySize, DateTime startTime, ushort lifetimeInMonths, ushort hashSizeInBits, bool isCA, X509Certificate2 issuerCAKeyCert ) : X509Certificate2
storeType string Type of certificate store (Directory) .
storePath string The store path (syntax depends on storeType).
password string The password to use to protect the certificate.
applicationUri string The application uri (created if not specified).
applicationName string Name of the application (optional if subjectName is specified).
subjectName string The subject used to create the certificate (optional if applicationName is specified).
domainNames IList The domain names that can be used to access the server machine (defaults to local computer name if not specified).
keySize ushort Size of the key (1024, 2048 or 4096).
startTime DateTime The start time.
lifetimeInMonths ushort The lifetime of the key in months.
hashSizeInBits ushort The hash size in bits.
isCA bool if set to true then a CA certificate is created.
issuerCAKeyCert X509Certificate2 The CA cert with the CA private key.
return X509Certificate2

CreateCertificateFromPKCS12() public static method

Creates a certificate from a PKCS #12 store with a private key.
public static CreateCertificateFromPKCS12 ( byte rawData, string password ) : X509Certificate2
rawData byte The raw PKCS #12 store data.
password string The password to use to access the store.
return X509Certificate2

Load() public static method

Loads the cached version of a certificate.
This function is necessary because all private keys used for cryptography operations must be in a key conatiner. Private keys stored in a PFX file have no key conatiner by default.
public static Load ( X509Certificate2 certificate, bool ensurePrivateKeyAccessible ) : X509Certificate2
certificate X509Certificate2 The certificate to load.
ensurePrivateKeyAccessible bool If true a key conatiner is created for a certificate that must be deleted by calling Cleanup.
return X509Certificate2