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.​SlhDsaOpenSsl

Assembly: System.Security.Cryptography

Inheritance: object → SlhDsa → SlhDsaOpenSsl

Implemented Interfaces

Represents an SLH-DSA key backed by OpenSSL.

Properties

Algorithm
Gets the specific SLH-DSA algorithm for this key.

Methods

protected void
Dispose​(bool disposing)
DuplicateKeyHandle​()
Gets a <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.
Returns A <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.
protected void
ExportSlhDsaPrivateKeyCore​(Span<​byte> destination)
protected void
ExportSlhDsaPublicKeyCore​(Span<​byte> destination)
protected void
SignDataCore​(ReadOnlySpan<​byte> data, ReadOnlySpan<​byte> context, Span<​byte> destination)
protected void
SignPreHashCore​(ReadOnlySpan<​byte> hash, ReadOnlySpan<​byte> context, string hashAlgorithmOid, Span<​byte> destination)
protected bool
TryExportPkcs8PrivateKeyCore​(Span<​byte> destination, Int32& bytesWritten)
protected bool
VerifyDataCore​(ReadOnlySpan<​byte> data, ReadOnlySpan<​byte> context, ReadOnlySpan<​byte> signature)
protected bool
VerifyPreHashCore​(ReadOnlySpan<​byte> hash, ReadOnlySpan<​byte> context, string hashAlgorithmOid, ReadOnlySpan<​byte> signature)
public void
Dispose​()
Inherited from SlhDsa
Releases all resources used by the <see cref="T:System.Security.Cryptography.SlhDsa" /> class.
public byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​byte> passwordBytes, PbeParameters pbeParameters)
Inherited from SlhDsa
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password.
Returns A byte array containing the PKCS#8 EncryptedPrivateKeyInfo representation of the this key.
passwordBytes The bytes to use as a password when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
public byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​char> password, PbeParameters pbeParameters)
Inherited from SlhDsa
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.
Returns A byte array containing the PKCS#8 EncryptedPrivateKeyInfo representation of the this key.
password The password to use when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
public byte[]
ExportEncryptedPkcs8PrivateKey​(string password, PbeParameters pbeParameters)
Inherited from SlhDsa
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.
Returns A byte array containing the PKCS#8 EncryptedPrivateKeyInfo representation of the this key.
password The password to use when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
public string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan<​byte> passwordBytes, PbeParameters pbeParameters)
Inherited from SlhDsa
<para>Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a byte-based password.</para>
Returns A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.
passwordBytes The bytes to use as a password when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
public string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan<​char> password, PbeParameters pbeParameters)
Inherited from SlhDsa
<para>Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a char-based password.</para>
Returns A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.
password The password to use when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
public string
ExportEncryptedPkcs8PrivateKeyPem​(string password, PbeParameters pbeParameters)
Inherited from SlhDsa
<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>
Returns A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.
password The password to use when encrypting the key material.
pbeParameters The password-based encryption (PBE) parameters to use when encrypting the key material.
public byte[]
ExportPkcs8PrivateKey​()
Inherited from SlhDsa
Exports the current key in the PKCS#8 PrivateKeyInfo format.
Returns A byte array containing the PKCS#8 PrivateKeyInfo representation of the this key.
public string
ExportPkcs8PrivateKeyPem​()
Inherited from SlhDsa
Exports the current key in a PEM-encoded representation of the PKCS#8 PrivateKeyInfo format.
Returns A string containing the PEM-encoded representation of the PKCS#8 PrivateKeyInfo.
public byte[]
ExportSlhDsaPrivateKey​()
Inherited from SlhDsa
Exports the current key in the FIPS 205 private key format.
Returns The FIPS 205 private key.
public void
ExportSlhDsaPrivateKey​(Span<​byte> destination)
Inherited from SlhDsa
Exports the current key in the FIPS 205 private key format.
destination <para>The buffer to receive the private key. Its length must be exactly <see cref="P:System.Security.Cryptography.SlhDsaAlgorithm.PrivateKeySizeInBytes" />.</para>
public byte[]
ExportSlhDsaPublicKey​()
Inherited from SlhDsa
Exports the public-key portion of the current key in the FIPS 205 public key format.
Returns The FIPS 205 public key.
public void
ExportSlhDsaPublicKey​(Span<​byte> destination)
Inherited from SlhDsa
Exports the public-key portion of the current key in the FIPS 205 public key format.
destination <para>The buffer to receive the public key. Its length must be exactly <see cref="P:System.Security.Cryptography.SlhDsaAlgorithm.PublicKeySizeInBytes" />.</para>
public byte[]
ExportSubjectPublicKeyInfo​()
Inherited from SlhDsa
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.
Returns A byte array containing the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.
public string
ExportSubjectPublicKeyInfoPem​()
Inherited from SlhDsa
<para>Exports the public-key portion of the current key in a PEM-encoded representation of the X.509 SubjectPublicKeyInfo format.</para>
Returns <para>A string containing the PEM-encoded representation of the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.</para>
public byte[]
SignData​(byte[] data, byte[] context = null)
Inherited from SlhDsa
Signs the specified data.
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>
public void
SignData​(ReadOnlySpan<​byte> data, Span<​byte> destination, ReadOnlySpan<​byte> context = null)
Inherited from SlhDsa
Signs the specified data, writing the signature into the provided buffer.
data The data to sign.
destination <para>The buffer to receive the signature. Its length must be exactly <see cref="P:System.Security.Cryptography.SlhDsaAlgorithm.SignatureSizeInBytes" />.</para>
context <para>An optional context-specific value to limit the scope of the signature.</para> <para>The default value is an empty buffer.</para>
public byte[]
SignPreHash​(byte[] hash, string hashAlgorithmOid, byte[] context = null)
Inherited from SlhDsa
Signs the specified hash using the FIPS 205 pre-hash signing algorithm.
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>
public void
SignPreHash​(ReadOnlySpan<​byte> hash, Span<​byte> destination, string hashAlgorithmOid, ReadOnlySpan<​byte> context = null)
Inherited from SlhDsa
Signs the specified hash using the FIPS 205 pre-hash signing algorithm, writing the signature into the provided buffer.
hash The hash to sign.
destination <para>The buffer to receive the signature. Its length must be exactly <see cref="P:System.Security.Cryptography.SlhDsaAlgorithm.SignatureSizeInBytes" />.</para>
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 an empty buffer.</para>
public bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​byte> passwordBytes, PbeParameters pbeParameters, Span<​byte> destination, Int32& bytesWritten)
Inherited from SlhDsa
public bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​char> password, PbeParameters pbeParameters, Span<​byte> destination, Int32& bytesWritten)
Inherited from SlhDsa
public bool
TryExportEncryptedPkcs8PrivateKey​(string password, PbeParameters pbeParameters, Span<​byte> destination, Int32& bytesWritten)
Inherited from SlhDsa
public bool
TryExportPkcs8PrivateKey​(Span<​byte> destination, Int32& bytesWritten)
Inherited from SlhDsa
public bool
TryExportSubjectPublicKeyInfo​(Span<​byte> destination, Int32& bytesWritten)
Inherited from SlhDsa
public bool
VerifyData​(byte[] data, byte[] signature, byte[] context = null)
Inherited from SlhDsa
Verifies that the specified signature is valid for this key and the provided data.
Returns <see langword="true" /> if the signature validates the data; otherwise, <see langword="false" /> .
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>
public bool
VerifyData​(ReadOnlySpan<​byte> data, ReadOnlySpan<​byte> signature, ReadOnlySpan<​byte> context = null)
Inherited from SlhDsa
Verifies that the specified signature is valid for this key and the provided data.
Returns <see langword="true" /> if the signature validates the data; otherwise, <see langword="false" /> .
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 an empty buffer.</para>
public bool
VerifyPreHash​(byte[] hash, byte[] signature, string hashAlgorithmOid, byte[] context = null)
Inherited from SlhDsa
Verifies that the specified FIPS 205 pre-hash signature is valid for this key and the provided hash.
Returns <see langword="true" /> if the signature validates the hash; otherwise, <see langword="false" /> .
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>
public bool
VerifyPreHash​(ReadOnlySpan<​byte> hash, ReadOnlySpan<​byte> signature, string hashAlgorithmOid, ReadOnlySpan<​byte> context = null)
Inherited from SlhDsa
Verifies that the specified FIPS 205 pre-hash signature is valid for this key and the provided hash.
Returns <see langword="true" /> if the signature validates the hash; otherwise, <see langword="false" /> .
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 an empty buffer.</para>
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