CertificateManager.Import method (1 of 4)

Imports an X509 certificate from the specified file path.

public static X509Certificate2 Import(string certPath)
parameter description
certPath The path to the certificate file.

Return Value

The imported X509Certificate2 instance.

See Also


CertificateManager.Import method (2 of 4)

Imports an X509 certificate from the specified file path, with optional private key file and key storage flags.

public static X509Certificate2 Import(string certPath, string? privateKeyPath = null, 
    X509KeyStorageFlags flags = X509KeyStorageFlags.Exportable)
parameter description
certPath The path to the certificate file.
privateKeyPath The path to the private key file, if separate.
flags Key storage flags for the imported certificate.

Return Value

The imported X509Certificate2 instance.

See Also


CertificateManager.Import method (3 of 4)

Imports an X509 certificate from the specified file path, with optional password and private key file.

public static X509Certificate2 Import(string certPath, ReadOnlySpan<char> password = default, 
    string? privateKeyPath = null, X509KeyStorageFlags flags = X509KeyStorageFlags.Exportable)
parameter description
certPath The path to the certificate file.
password The password for the certificate, if required.
privateKeyPath The path to the private key file, if separate.
flags Key storage flags for the imported certificate.

Return Value

The imported X509Certificate2 instance.

See Also


CertificateManager.Import method (4 of 4)

Imports an X509 certificate from the specified file path, using a SecureString password and optional private key file.

public static X509Certificate2 Import(string certPath, SecureString password, 
    string? privateKeyPath = null, X509KeyStorageFlags flags = X509KeyStorageFlags.Exportable)
parameter description
certPath The path to the certificate file.
password The SecureString password for the certificate, if required.
privateKeyPath The path to the private key file, if separate.
flags Key storage flags for the imported certificate.

Return Value

The imported X509Certificate2 instance.

See Also