ECDiffieHellmanCng.TryExportEncryptedPkcs8PrivateKey Method

Definition

Overloads

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.

C#
public override bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);

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.

destination
Span<Byte>

The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data.

bytesWritten
Int32

When this method returns, contains a value that indicates the number of bytes written to destination. This parameter is treated as uninitialized.

Returns

true if destination is big enough to receive the output; otherwise, false.

Applies to

.NET 10 and other versions
Product Versions
.NET 7, 8, 9, 10

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

C#
public override bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);

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.

destination
Span<Byte>

The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data.

bytesWritten
Int32

When this method returns, contains a value that indicates the number of bytes written to destination. This parameter is treated as uninitialized.

Returns

true if destination is big enough to receive the output; otherwise, false.

Applies to

.NET 10 and other versions
Product Versions
.NET 7, 8, 9, 10