Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

X509Certificate.ExportPkcs12 Method

Definition

Namespace:
System.Security.Cryptography.X509Certificates
Assemblies:
netstandard.dll, System.Security.Cryptography.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
ExportPkcs12(PbeParameters, String)

Exports the certificate and private key in PKCS#12 / PFX format.

ExportPkcs12(Pkcs12ExportPbeParameters, String)

Exports the certificate and private key in PKCS#12 / PFX format.

ExportPkcs12(PbeParameters, String)

Source:
X509Certificate.cs
Source:
X509Certificate.cs

Exports the certificate and private key in PKCS#12 / PFX format.

public:
 cli::array <System::Byte> ^ ExportPkcs12(System::Security::Cryptography::PbeParameters ^ exportParameters, System::String ^ password);
public byte[] ExportPkcs12(System.Security.Cryptography.PbeParameters exportParameters, string? password);
member this.ExportPkcs12 : System.Security.Cryptography.PbeParameters * string -> byte[]
Public Function ExportPkcs12 (exportParameters As PbeParameters, password As String) As Byte()

Parameters

exportParameters
PbeParameters

The algorithm parameters to use for the export.

password
String

The password to use for the export.

Returns

Byte[]

A byte array containing the encoded PKCS#12.

Exceptions

password contains a Unicode 'NULL' character.

exportParameters is null .

The current instance is disposed.

-or-

The export operation failed.

-or-

exportParameters specifies a HashAlgorithm value that is not supported for the EncryptionAlgorithm value.

-or-

exportParameters contains an invalid encryption algorithm for EncryptionAlgorithm.

Applies to

ExportPkcs12(Pkcs12ExportPbeParameters, String)

Source:
X509Certificate.cs
Source:
X509Certificate.cs

Exports the certificate and private key in PKCS#12 / PFX format.

public:
 cli::array <System::Byte> ^ ExportPkcs12(System::Security::Cryptography::X509Certificates::Pkcs12ExportPbeParameters exportParameters, System::String ^ password);
public byte[] ExportPkcs12(System.Security.Cryptography.X509Certificates.Pkcs12ExportPbeParameters exportParameters, string? password);
member this.ExportPkcs12 : System.Security.Cryptography.X509Certificates.Pkcs12ExportPbeParameters * string -> byte[]
Public Function ExportPkcs12 (exportParameters As Pkcs12ExportPbeParameters, password As String) As Byte()

Parameters

exportParameters
Pkcs12ExportPbeParameters

The algorithm parameters to use for the export.

password
String

The password to use for the export.

Returns

Byte[]

A byte array containing the encoded PKCS#12.

Exceptions

password contains a Unicode 'NULL' character.

exportParameters is not a valid value.

The current instance is disposed.

-or-

The export operation failed.

Applies to


Feedback

Was this page helpful?