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.
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters, Span<Char>, Int32) |
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password, PEM encoded. |
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters, Span<Char>, Int32) |
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password, PEM encoded. |
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password, PEM encoded.
public:
bool TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<System::Byte> passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters, Span<char> destination, [Runtime::InteropServices::Out] int % charsWritten);
public bool TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, Span<char> destination, out int charsWritten);
member this.TryExportEncryptedPkcs8PrivateKeyPem : ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters * Span<char> * int -> bool
Public Function TryExportEncryptedPkcs8PrivateKeyPem (passwordBytes As ReadOnlySpan(Of Byte), pbeParameters As PbeParameters, destination As Span(Of Char), ByRef charsWritten As Integer) As Boolean
The bytes to use as a password when encrypting the key material.
The password-based encryption (PBE) parameters to use when encrypting the key material.
The character span to receive the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo data.
When this method returns, contains a value that indicates the number of characters written to destination
. This parameter is treated as uninitialized.
true
if destination
is big enough to receive the output; otherwise, false
.
An implementation for TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32) has not been provided.
The key could not be exported.
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.
Product | Versions |
---|---|
.NET | 8, 9, 10 |
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password, PEM encoded.
public:
bool TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, System::Security::Cryptography::PbeParameters ^ pbeParameters, Span<char> destination, [Runtime::InteropServices::Out] int % charsWritten);
public bool TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters, Span<char> destination, out int charsWritten);
member this.TryExportEncryptedPkcs8PrivateKeyPem : ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters * Span<char> * int -> bool
Public Function TryExportEncryptedPkcs8PrivateKeyPem (password As ReadOnlySpan(Of Char), pbeParameters As PbeParameters, destination As Span(Of Char), ByRef charsWritten As Integer) As Boolean
The password to use when encrypting the key material.
The password-based encryption (PBE) parameters to use when encrypting the key material.
The character span to receive the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo data.
When this method returns, contains a value that indicates the number of characters written to destination
. This parameter is treated as uninitialized.
true
if destination
is big enough to receive the output; otherwise, false
.
An implementation for TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32) has not been provided.
The key could not be exported.
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.
Product | Versions |
---|---|
.NET | 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