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.​MLDsaOpenSsl
Assembly: System.Security.Cryptography
Inheritance: object → MLDsa → MLDsaOpenSsl
Represents an ML-DSA key backed by OpenSSL.
Properties
public
MLDsaAlgorithm
Algorithm
Gets the specific ML-DSA algorithm for this key.
Methods
protected
void
Dispose​(bool disposing)
public
SafeEvpPKeyHandle
DuplicateKeyHandle​() Returns A <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.
Gets a <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.
protected
void
SignDataCore​(ReadOnlySpan`1 data,
ReadOnlySpan`1 context,
Span`1 destination)
protected
void
SignPreHashCore​(ReadOnlySpan`1 hash,
ReadOnlySpan`1 context,
string hashAlgorithmOid,
Span`1 destination)
protected
bool
TryExportPkcs8PrivateKeyCore​(Span`1 destination,
Int32& bytesWritten)
protected
bool
VerifyDataCore​(ReadOnlySpan`1 data,
ReadOnlySpan`1 context,
ReadOnlySpan`1 signature)
protected
bool
VerifyPreHashCore​(ReadOnlySpan`1 hash,
ReadOnlySpan`1 context,
string hashAlgorithmOid,
ReadOnlySpan`1 signature)
Releases all resources used by the <see cref="T:System.Security.Cryptography.MLDsa" /> class.
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters)
Inherited from MLDsa
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
Inherited from MLDsa
public
byte[]
ExportEncryptedPkcs8PrivateKey​(string password,
PbeParameters pbeParameters)
Inherited from MLDsa
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 the 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)
Inherited from MLDsa
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
Inherited from MLDsa
public
string
ExportEncryptedPkcs8PrivateKeyPem​(string password,
PbeParameters pbeParameters)
Inherited from MLDsa
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.
<p>Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a char-based password.</p>
public
byte[]
ExportMLDsaPrivateKey​()
Inherited from MLDsa
Returns The FIPS 204 private key.
Exports the current key in the FIPS 204 private key format.
public
byte[]
ExportMLDsaPrivateSeed​()
Inherited from MLDsa
Returns The FIPS 204 private seed.
Exports the private seed in the FIPS 204 private seed format.
public
byte[]
ExportMLDsaPublicKey​()
Inherited from MLDsa
Returns The FIPS 204 public key.
Exports the public-key portion of the current key in the FIPS 204 public key format.
public
byte[]
ExportPkcs8PrivateKey​()
Inherited from MLDsa
Returns A byte array containing the PKCS#8 PrivateKeyInfo representation of the this key.
Exports the current key in the PKCS#8 PrivateKeyInfo format.
public
string
ExportPkcs8PrivateKeyPem​()
Inherited from MLDsa
Returns <para>A string containing the PEM-encoded representation of the PKCS#8 PrivateKeyInfo representation of the public-key portion of this key.</para>
Exports the current key in a PEM-encoded representation of the PKCS#8 PrivateKeyInfo format.
public
byte[]
ExportSubjectPublicKeyInfo​()
Inherited from MLDsa
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​()
Inherited from MLDsa
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
byte[]
SignData​(byte[] data,
byte[] context = null)
Inherited from MLDsa
data
The data to sign.
context
<para>An optional context-specific value to limit the scope of the signature.</para> <para>The default value is <see langword="null" />.</para>
Returns ML-DSA signature for the specified data.
Signs the specified data.
public
void
SignData​(ReadOnlySpan`1 data,
Span`1 destination,
ReadOnlySpan`1 context = null)
Inherited from MLDsa
public
byte[]
SignMu​(byte[] externalMu)
Inherited from MLDsa
externalMu
The signature mu value to sign.
Returns ML-DSA signature for the specified mu value.
Signs the specified externally computed signature mu (μ) value.
public
void
SignMu​(ReadOnlySpan`1 externalMu,
Span`1 destination)
Inherited from MLDsa
public
byte[]
SignPreHash​(byte[] hash,
string hashAlgorithmOid,
byte[] context = null)
Inherited from MLDsa
hash
The hash to sign.
hashAlgorithmOid
The OID of the hash algorithm used to create the hash.
context
<para>An optional context-specific value to limit the scope of the signature.</para> <para>The default value is <see langword="null" />.</para>
Signs the specified hash using the FIPS 204 pre-hash signing algorithm.
public
void
SignPreHash​(ReadOnlySpan`1 hash,
Span`1 destination,
string hashAlgorithmOid,
ReadOnlySpan`1 context = null)
Inherited from MLDsa
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
Inherited from MLDsa
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
Inherited from MLDsa
public
bool
TryExportEncryptedPkcs8PrivateKey​(string password,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
Inherited from MLDsa
public
bool
TryExportPkcs8PrivateKey​(Span`1 destination,
Int32& bytesWritten)
Inherited from MLDsa
public
bool
TryExportSubjectPublicKeyInfo​(Span`1 destination,
Int32& bytesWritten)
Inherited from MLDsa
public
bool
VerifyData​(byte[] data,
byte[] signature,
byte[] context = null)
Inherited from MLDsa
data
The data to verify.
signature
The signature to verify.
context
<para>The context value which was provided during signing.</para> <para>The default value is <see langword="null" />.</para>
Returns <see langword="true" /> if the signature validates the data; otherwise, <see langword="false" /> .
Verifies that the specified signature is valid for this key and the provided data.
public
bool
VerifyData​(ReadOnlySpan`1 data,
ReadOnlySpan`1 signature,
ReadOnlySpan`1 context = null)
Inherited from MLDsa
public
bool
VerifyMu​(byte[] externalMu,
byte[] signature)
Inherited from MLDsa
externalMu
The signature mu value.
signature
The signature to verify.
Returns <p>
<code data-dev-comment-type="langword">true</code> if the digital signature is valid for the provided mu value; otherwise, <code data-dev-comment-type="langword">false</code>.</p>
Verifies that a digital signature is valid for the provided externally computed signature mu (μ) value.
public
bool
VerifyMu​(ReadOnlySpan`1 externalMu,
ReadOnlySpan`1 signature)
Inherited from MLDsa
public
bool
VerifyPreHash​(byte[] hash,
byte[] signature,
string hashAlgorithmOid,
byte[] context = null)
Inherited from MLDsa
hash
The hash to verify.
signature
The signature to verify.
hashAlgorithmOid
The OID of the hash algorithm used to create the hash.
context
<para>The context value which was provided during signing.</para> <para>The default value is <see langword="null" />.</para>
Returns <see langword="true" /> if the signature validates the hash; otherwise, <see langword="false" /> .
Verifies that the specified FIPS 204 pre-hash signature is valid for this key and the provided hash.
public
bool
VerifyPreHash​(ReadOnlySpan`1 hash,
ReadOnlySpan`1 signature,
string hashAlgorithmOid,
ReadOnlySpan`1 context = null)
Inherited from MLDsa
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object