CertificateManager.Export method (1 of 2)

Exports the specified X509 certificate to a file in the given format, with optional password and private key inclusion.

public static void Export(X509Certificate2 cert, string filePath, ExportFormat fmt, 
    ReadOnlySpan<char> password = default, bool includePrivateKey = false)
parameter description
cert The X509Certificate2 to export.
filePath The file path to export the certificate to.
fmt The export format (Pfx or Pem).
password The password to protect the exported certificate or private key, if applicable.
includePrivateKey Whether to include the private key in the export.

See Also


CertificateManager.Export method (2 of 2)

Exports the specified X509 certificate to a file in the given format, using a SecureString password and optional private key inclusion.

public static void Export(X509Certificate2 cert, string filePath, ExportFormat fmt, 
    SecureString password, bool includePrivateKey = false)
parameter description
cert The X509Certificate2 to export.
filePath The file path to export the certificate to.
fmt The export format (Pfx or Pem).
password The SecureString password to protect the exported certificate or private key, if applicable.
includePrivateKey Whether to include the private key in the export.

See Also