Edit

Share via


MLDsa.SignPreHash Method

Definition

Overloads

SignPreHash(ReadOnlySpan<Byte>, Span<Byte>, String, ReadOnlySpan<Byte>)

Signs the specified hash using the FIPS 204 pre-hash signing algorithm, writing the signature into the provided buffer.

SignPreHash(Byte[], String, Byte[])

Signs the specified hash using the FIPS 204 pre-hash signing algorithm.

SignPreHash(ReadOnlySpan<Byte>, Span<Byte>, String, ReadOnlySpan<Byte>)

Source:
MLDsa.cs

Signs the specified hash using the FIPS 204 pre-hash signing algorithm, writing the signature into the provided buffer.

[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void SignPreHash(ReadOnlySpan<byte> hash, Span<byte> destination, string hashAlgorithmOid, ReadOnlySpan<byte> context = default);
public void SignPreHash(ReadOnlySpan<byte> hash, Span<byte> destination, string hashAlgorithmOid, ReadOnlySpan<byte> context = default);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.SignPreHash : ReadOnlySpan<byte> * Span<byte> * string * ReadOnlySpan<byte> -> unit
member this.SignPreHash : ReadOnlySpan<byte> * Span<byte> * string * ReadOnlySpan<byte> -> unit
Public Sub SignPreHash (hash As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithmOid As String, Optional context As ReadOnlySpan(Of Byte) = Nothing)

Parameters

hash
ReadOnlySpan<Byte>

The hash to sign.

destination
Span<Byte>

The buffer to receive the signature. Its length must be exactly SignatureSizeInBytes.

hashAlgorithmOid
String

The OID of the hash algorithm used to create the hash.

context
ReadOnlySpan<Byte>

An optional context-specific value to limit the scope of the signature.

The default value is an empty buffer.

Attributes

Exceptions

hashAlgorithmOid is null.

The buffer in destination is the incorrect length to receive the signature.

context has a Length in excess of 255 bytes.

This instance has been disposed.

hashAlgorithmOid is not a well-formed OID.

-or-

hashAlgorithmOid is a well-known algorithm and hash does not have the expected length.

-or-

The instance represents only a public key.

-or-

An error occurred while signing the hash.

Applies to

SignPreHash(Byte[], String, Byte[])

Source:
MLDsa.cs

Signs the specified hash using the FIPS 204 pre-hash signing algorithm.

[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public byte[] SignPreHash(byte[] hash, string hashAlgorithmOid, byte[]? context = default);
public byte[] SignPreHash(byte[] hash, string hashAlgorithmOid, byte[]? context = default);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.SignPreHash : byte[] * string * byte[] -> byte[]
member this.SignPreHash : byte[] * string * byte[] -> byte[]
Public Function SignPreHash (hash As Byte(), hashAlgorithmOid As String, Optional context As Byte() = Nothing) As Byte()

Parameters

hash
Byte[]

The hash to sign.

hashAlgorithmOid
String

The OID of the hash algorithm used to create the hash.

context
Byte[]

An optional context-specific value to limit the scope of the signature.

The default value is null.

Returns

Byte[]
Attributes

Exceptions

hash or hashAlgorithmOid is null.

An error occurred while verifying the data.

hashAlgorithmOid is not a well-formed OID.

-or-

hashAlgorithmOid is a well-known algorithm and hash does not have the expected length.

-or-

The instance represents only a public key.

-or-

An error occurred while signing the hash.

Applies to