Redigeeri

Jagamisviis:


ECDsa.ImportFromEncryptedPem Method

Definition

Overloads

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.

public:
 override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
public override void ImportFromEncryptedPem (ReadOnlySpan<char> input, ReadOnlySpan<char> password);
override this.ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<char> -> unit
Public Overrides Sub ImportFromEncryptedPem (input As ReadOnlySpan(Of Char), password As ReadOnlySpan(Of Char))

Parameters

input
ReadOnlySpan<Char>

The PEM text of the encrypted key to import.

password
ReadOnlySpan<Char>

The password to use for decrypting the key material.

Exceptions

input does not contain a PEM-encoded key with a recognized label.

-or-

input contains multiple PEM-encoded keys with a recognized label.

The password is incorrect.

-or-

The base-64 decoded contents of the PEM text from input do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.

-or-

The base-64 decoded contents of the PEM text from input indicate the key is for an algorithm other than the algorithm represented by this instance.

-or-

The base-64 decoded contents of the PEM text from input represent the key in a format that is not supported.

-or-

The algorithm-specific key import failed.

Remarks

When the base-64 decoded contents of input indicate an algorithm that uses PBKDF1 (Password-Based Key Derivation Function 1) or PBKDF2 (Password-Based Key Derivation Function 2), the password is converted to bytes via the UTF-8 encoding.

Unsupported or malformed PEM-encoded objects will be ignored. If multiple supported PEM labels are found, an exception is thrown to prevent importing a key when the key is ambiguous.

This method supports the ENCRYPTED PRIVATE KEY PEM label.

Applies to

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.

public:
 override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<System::Byte> passwordBytes);
public override void ImportFromEncryptedPem (ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
override this.ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<byte> -> unit
Public Overrides Sub ImportFromEncryptedPem (input As ReadOnlySpan(Of Char), passwordBytes As ReadOnlySpan(Of Byte))

Parameters

input
ReadOnlySpan<Char>

The PEM text of the encrypted key to import.

passwordBytes
ReadOnlySpan<Byte>

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

Exceptions

input does not contain a PEM-encoded key with a recognized label.

-or-

input contains multiple PEM-encoded keys with a recognized label.

The password is incorrect.

-or-

The base-64 decoded contents of the PEM text from input do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.

-or-

The base-64 decoded contents of the PEM text from input indicate the key is for an algorithm other than the algorithm represented by this instance.

-or-

The base-64 decoded contents of the PEM text from input represent the key in a format that is not supported.

-or-

The algorithm-specific key import failed.

Remarks

The password bytes are passed directly into the Key Derivation Function (KDF) used by the algorithm indicated by pbeParameters. This enables compatibility with other systems that use a text encoding other than UTF-8 when processing passwords with PBKDF2 (Password-Based Key Derivation Function 2).

Unsupported or malformed PEM-encoded objects will be ignored. If multiple supported PEM labels are found, an exception is thrown to prevent importing a key when the key is ambiguous.

This method supports the ENCRYPTED PRIVATE KEY PEM label.

Applies to