Edit

Share via


MLDsa.VerifyPreHash Method

Definition

Overloads

VerifyPreHash(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, String, ReadOnlySpan<Byte>)

Verifies that the specified FIPS 204 pre-hash signature is valid for this key and the provided hash.

VerifyPreHash(Byte[], Byte[], String, Byte[])

Verifies that the specified FIPS 204 pre-hash signature is valid for this key and the provided hash.

VerifyPreHash(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, String, ReadOnlySpan<Byte>)

Source:
MLDsa.cs

Verifies that the specified FIPS 204 pre-hash signature is valid for this key and the provided hash.

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

Parameters

hash
ReadOnlySpan<Byte>

The hash to verify.

signature
ReadOnlySpan<Byte>

The signature to verify.

hashAlgorithmOid
String

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

context
ReadOnlySpan<Byte>

The context value which was provided during signing.

The default value is an empty buffer.

Returns

true if the signature validates the hash; otherwise, false.

Attributes

Exceptions

hashAlgorithmOid is null.

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-

An error occurred while verifying the hash.

Applies to

VerifyPreHash(Byte[], Byte[], String, Byte[])

Source:
MLDsa.cs

Verifies that the specified FIPS 204 pre-hash signature is valid for this key and the provided hash.

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

Parameters

hash
Byte[]

The hash to verify.

signature
Byte[]

The signature to verify.

hashAlgorithmOid
String

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

context
Byte[]

The context value which was provided during signing.

The default value is null.

Returns

true if the signature validates the hash; otherwise, false.

Attributes

Exceptions

hash or signature or hashAlgorithmOid is null.

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-

An error occurred while verifying the hash.

Remarks

A null context is treated as empty.

Applies to