Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Security.​Cryptography.​MLKem

Assembly: System.Security.Cryptography

Inheritance: object → MLKem

Represents an ML-KEM key.

Properties

Algorithm
Gets the specific ML-KEM algorithm for this key.

Methods

public byte[]
Decapsulate​(byte[] ciphertext)
ciphertext The ciphertext.
Returns The shared secret.
Decapsulates a shared secret from a provided ciphertext.
public void
Decapsulate​(ReadOnlySpan`1 ciphertext, Span`1 sharedSecret)
protected void
DecapsulateCore​(ReadOnlySpan`1 ciphertext, Span`1 sharedSecret)
public void
Dispose​()
Releases all resources used by the <see cref="T:System.Security.Cryptography.MLKem" /> class.
protected void
Dispose​(bool disposing)
disposing <para> <see langword="true" /> to release managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</para>
<para>Called by the <c>Dispose()</c> and <c>Finalize()</c> methods to release the managed and unmanaged resources used by the current instance of the <see cref="T:System.Security.Cryptography.MLKem" /> class.</para>
public void
Encapsulate​(Byte[]& ciphertext, Byte[]& sharedSecret)
public void
Encapsulate​(Span`1 ciphertext, Span`1 sharedSecret)
protected void
EncapsulateCore​(Span`1 ciphertext, Span`1 sharedSecret)
public byte[]
ExportDecapsulationKey​()
Returns The decapsulation key.
Exports the decapsulation key.
public void
ExportDecapsulationKey​(Span`1 destination)
protected void
ExportDecapsulationKeyCore​(Span`1 destination)
public byte[]
ExportEncapsulationKey​()
Returns The encapsulation key.
Exports the encapsulation key.
public void
ExportEncapsulationKey​(Span`1 destination)
protected void
ExportEncapsulationKeyCore​(Span`1 destination)
public byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes, PbeParameters pbeParameters)
public byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password, PbeParameters pbeParameters)
public byte[]
ExportEncryptedPkcs8PrivateKey​(string password, PbeParameters pbeParameters)
password The password to use when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
Returns A byte array containing the PKCS#8 EncryptedPrivateKeyInfo representation of this key.
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.
public string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 passwordBytes, PbeParameters pbeParameters)
public string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 password, PbeParameters pbeParameters)
public string
ExportEncryptedPkcs8PrivateKeyPem​(string password, PbeParameters pbeParameters)
password The password to use when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
Returns A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.
<para>Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a string password.</para>
public byte[]
ExportPkcs8PrivateKey​()
Returns A byte array containing the PKCS#8 PrivateKeyInfo representation of this key.
Export the current key in the PKCS#8 PrivateKeyInfo format.
public string
ExportPkcs8PrivateKeyPem​()
Returns A string containing the PEM-encoded representation of the PKCS#8 PrivateKeyInfo.
Exports the current key in a PEM-encoded representation of the PKCS#8 PrivateKeyInfo format.
public byte[]
ExportPrivateSeed​()
Returns The private seed.
Exports the private seed.
public void
ExportPrivateSeed​(Span`1 destination)
protected void
ExportPrivateSeedCore​(Span`1 destination)
public byte[]
ExportSubjectPublicKeyInfo​()
Returns A byte array containing the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.
public string
ExportSubjectPublicKeyInfoPem​()
Returns <para>A string containing the PEM-encoded representation of the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.</para>
<para>Exports the public-key portion of the current key in a PEM-encoded representation of the X.509 SubjectPublicKeyInfo format.</para>
public bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes, PbeParameters pbeParameters, Span`1 destination, Int32& bytesWritten)
public bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password, PbeParameters pbeParameters, Span`1 destination, Int32& bytesWritten)
public bool
TryExportEncryptedPkcs8PrivateKey​(string password, PbeParameters pbeParameters, Span`1 destination, Int32& bytesWritten)
public bool
TryExportPkcs8PrivateKey​(Span`1 destination, Int32& bytesWritten)
protected bool
TryExportPkcs8PrivateKeyCore​(Span`1 destination, Int32& bytesWritten)
public bool
TryExportSubjectPublicKeyInfo​(Span`1 destination, Int32& bytesWritten)
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object