AsymmetricAlgorithm.ExportEncryptedPkcs8PrivateKeyPem Method

Definition

Overloads

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password, PEM encoded.

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password, PEM encoded.

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password, PEM encoded.

public:
 System::String ^ ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public string ExportEncryptedPkcs8PrivateKeyPem (ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters);
member this.ExportEncryptedPkcs8PrivateKeyPem : ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters -> string
Public Function ExportEncryptedPkcs8PrivateKeyPem (password As ReadOnlySpan(Of Char), pbeParameters As PbeParameters) As String

Parameters

password
ReadOnlySpan<Char>

The password to use when encrypting the key material.

pbeParameters
PbeParameters

The password-based encryption (PBE) parameters to use when encrypting the key material.

Returns

A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.

Exceptions

The key could not be exported.

Remarks

When pbeParameters indicates an algorithm that uses PBKDF2 (Password-Based Key Derivation Function 2), the password is converted to bytes via the UTF-8 encoding.

          A PEM-encoded PKCS#8 EncryptedPrivateKeyInfo will begin with
         `-----BEGIN ENCRYPTED PRIVATE KEY-----` and end with
         `-----END ENCRYPTED PRIVATE KEY-----`, with the base64 encoded DER
          contents of the key between the PEM boundaries.

          The PEM is encoded according to the IETF RFC 7468 "strict" encoding rules.

Applies to

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password, PEM encoded.

public:
 System::String ^ ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<System::Byte> passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public string ExportEncryptedPkcs8PrivateKeyPem (ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);
member this.ExportEncryptedPkcs8PrivateKeyPem : ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters -> string
Public Function ExportEncryptedPkcs8PrivateKeyPem (passwordBytes As ReadOnlySpan(Of Byte), pbeParameters As PbeParameters) As String

Parameters

passwordBytes
ReadOnlySpan<Byte>

The bytes to use as a password when encrypting the key material.

pbeParameters
PbeParameters

The password-based encryption (PBE) parameters to use when encrypting the key material.

Returns

A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.

Exceptions

The key could not be exported.

Remarks

A PEM-encoded PKCS#8 EncryptedPrivateKeyInfo will begin with -----BEGIN ENCRYPTED PRIVATE KEY----- and end with -----END ENCRYPTED PRIVATE KEY-----, with the base64 encoded DER contents of the key between the PEM boundaries.

The PEM is encoded according to the IETF RFC 7468 "strict" encoding rules.

Applies to