AsymmetricAlgorithm.ImportFromEncryptedPem Method

Definition

Overloads

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

When overridden in a derived class, imports an encrypted RFC 7468 PEM-encoded key, replacing the keys for this object.

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

When overridden in a derived class, imports an encrypted RFC 7468 PEM-encoded key, replacing the keys for this object.

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

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

When overridden in a derived class, imports an encrypted RFC 7468 PEM-encoded key, replacing the keys for this object.

public:
 virtual void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
public virtual void ImportFromEncryptedPem (ReadOnlySpan<char> input, ReadOnlySpan<char> password);
abstract member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<char> -> unit
override this.ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<char> -> unit
Public Overridable 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

A derived type has not overridden this member.

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

Because each algorithm may have algorithm-specific PEM labels, the default behavior will throw NotImplementedException.

Applies to

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

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

When overridden in a derived class, imports an encrypted RFC 7468 PEM-encoded key, replacing the keys for this object.

public:
 virtual void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<System::Byte> passwordBytes);
public virtual void ImportFromEncryptedPem (ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
abstract member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<byte> -> unit
override this.ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<byte> -> unit
Public Overridable 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

A derived type has not overridden this member.

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

Because each algorithm may have algorithm-specific PEM labels, the default behavior will throw NotImplementedException.

Applies to