MLKem.TryExportEncryptedPkcs8PrivateKey Method
Definition
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.
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(String, 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)
- Source:
- MLKem.cs
- Source:
- MLKem.cs
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.
public:
bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<System::Byte> passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.TryExportEncryptedPkcs8PrivateKey : ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
member this.TryExportEncryptedPkcs8PrivateKey : ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
Public Function TryExportEncryptedPkcs8PrivateKey (passwordBytes As ReadOnlySpan(Of Byte), pbeParameters As PbeParameters, destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean
Parameters
- passwordBytes
- ReadOnlySpan<Byte>
The password to use when encrypting the key material.
- pbeParameters
- PbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
- bytesWritten
- Int32
When this method returns, contains the number of bytes written to the destination buffer.
This parameter is treated as uninitialized.
Returns
true if destination was large enough to hold the result; otherwise, false.
- Attributes
Exceptions
pbeParameters is null.
This instance has been disposed.
This instance only represents a public key.
-or-
The private key is not exportable.
-or-
An error occurred while exporting the key.
-or-
pbeParameters does not represent a valid password-based encryption algorithm.
Applies to
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)
- Source:
- MLKem.cs
- Source:
- MLKem.cs
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.
public:
bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, System::Security::Cryptography::PbeParameters ^ pbeParameters, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.TryExportEncryptedPkcs8PrivateKey : ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
member this.TryExportEncryptedPkcs8PrivateKey : ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
Public Function TryExportEncryptedPkcs8PrivateKey (password As ReadOnlySpan(Of Char), pbeParameters As PbeParameters, destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean
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.
- bytesWritten
- Int32
When this method returns, contains the number of bytes written to the destination buffer.
This parameter is treated as uninitialized.
Returns
true if destination was large enough to hold the result; otherwise, false.
- Attributes
Exceptions
pbeParameters is null.
This instance has been disposed.
This instance only represents a public key.
-or-
The private key is not exportable.
-or-
An error occurred while exporting the key.
-or-
pbeParameters does not represent a valid password-based encryption algorithm.
Applies to
TryExportEncryptedPkcs8PrivateKey(String, PbeParameters, Span<Byte>, Int32)
- Source:
- MLKem.cs
- Source:
- MLKem.cs
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.
public:
bool TryExportEncryptedPkcs8PrivateKey(System::String ^ password, System::Security::Cryptography::PbeParameters ^ pbeParameters, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public bool TryExportEncryptedPkcs8PrivateKey(string password, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
public bool TryExportEncryptedPkcs8PrivateKey(string password, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.TryExportEncryptedPkcs8PrivateKey : string * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
member this.TryExportEncryptedPkcs8PrivateKey : string * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
Public Function TryExportEncryptedPkcs8PrivateKey (password As String, pbeParameters As PbeParameters, destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean
Parameters
- password
- String
The password to use when encrypting the key material.
- pbeParameters
- PbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
- bytesWritten
- Int32
When this method returns, contains the number of bytes written to the destination buffer.
This parameter is treated as uninitialized.
Returns
true if destination was large enough to hold the result; otherwise, false.
- Attributes
Exceptions
password or pbeParameters is null.
This instance has been disposed.
This instance only represents a public key.
-or-
The private key is not exportable.
-or-
An error occurred while exporting the key.
-or-
pbeParameters does not represent a valid password-based encryption algorithm.