語言

MLDsa.SignPreHash 方法

定義

使用 FIPS 204 預雜湊簽名演算法對指定的雜湊值進行簽名。

多載

名稱 Description
SignPreHash(ReadOnlySpan<Byte>, Span<Byte>, String, ReadOnlySpan<Byte>)

使用 FIPS 204 預雜湊簽名演算法對指定的雜湊值進行簽名,並將簽章寫入所提供的緩衝區。

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

使用 FIPS 204 預雜湊簽名演算法對指定的雜湊值進行簽名。

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

來源:
MLDsa.cs
來源:
MLDsa.cs
來源:
MLDsa.cs

使用 FIPS 204 預雜湊簽名演算法對指定的雜湊值進行簽名,並將簽章寫入所提供的緩衝區。

[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)

參數

hash
ReadOnlySpan<Byte>

要簽名的哈希。

destination
Span<Byte>

接收簽名的緩衝區。 其長度必須恰好 SignatureSizeInBytes為 。

hashAlgorithmOid
String

用於建立雜湊值的雜湊演算法的OID。

context
ReadOnlySpan<Byte>

一個可選的上下文特定值,用以限制簽名的範圍。

預設值是空緩衝區。

屬性

例外狀況

hashAlgorithmOid 是 null。

該 destination 緩衝區長度錯誤,無法接收簽章。

context 擁有 Length 超過 255 位元組的空間。

這個實例已經被處理掉了。

hashAlgorithmOid 並非良好形成的 OID。

-或-

hashAlgorithmOid 是一個知名的演算法,且 hash 不具備預期長度。

-或-

該實例僅代表一個公鑰。

-或-

在簽署雜湊值時發生錯誤。

適用於

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

來源:
MLDsa.cs
來源:
MLDsa.cs
來源:
MLDsa.cs

使用 FIPS 204 預雜湊簽名演算法對指定的雜湊值進行簽名。

[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()

參數

hash
Byte[]

要簽名的哈希。

hashAlgorithmOid
String

用於建立雜湊值的雜湊演算法的OID。

context
Byte[]

一個可選的上下文特定值,用以限制簽名的範圍。

預設值為 null。

傳回

Byte[]
屬性

例外狀況

hash 或 hashAlgorithmOid 為 null。

在驗證資料時發生錯誤。

hashAlgorithmOid 並非良好形成的 OID。

-或-

hashAlgorithmOid 是一個知名的演算法,且 hash 不具備預期長度。

-或-

該實例僅代表一個公鑰。

-或-

在簽署雜湊值時發生錯誤。

適用於