Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
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. |
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))
The PEM text of the encrypted key to import.
The bytes to use as a password when decrypting the key material.
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 <code data-dev-comment-type="paramref">input</code> do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.
-or-
The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> 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 <code data-dev-comment-type="paramref">input</code> represent the key in a format that is not supported.
-or-
The algorithm-specific key import failed.
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.
Product | Versions |
---|---|
.NET | 5, 6, 7, 8, 9, 10 |
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))
The PEM text of the encrypted key to import.
The password to use for decrypting the key material.
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 <code data-dev-comment-type="paramref">input</code> do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.
-or-
The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> 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 <code data-dev-comment-type="paramref">input</code> represent the key in a format that is not supported.
-or-
The algorithm-specific key import failed.
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.
Product | Versions |
---|---|
.NET | 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in