RSA.SignHash 方法

定義

多載

SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

在衍生類別中覆寫時,針對指定雜湊值的簽章,使用指定的填補來計算。

SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

針對指定雜湊值的簽章,使用指定的填補來計算。

SignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

使用目前的金鑰簽署哈希,並將簽章寫入提供的緩衝區。

SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

來源:
RSA.cs
來源:
RSA.cs
來源:
RSA.cs

在衍生類別中覆寫時,針對指定雜湊值的簽章,使用指定的填補來計算。

C#
public virtual byte[] SignHash(byte[] hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
C#
public abstract byte[] SignHash(byte[] hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);

參數

hash
Byte[]

要簽署之資料的雜湊值。

hashAlgorithm
HashAlgorithmName

用來建立該資料雜湊值的雜湊演算法。

padding
RSASignaturePadding

填補。

傳回

Byte[]

指定雜湊值的 RSA 簽章。

例外狀況

衍生的類別必須覆寫這個方法。

datapaddingnull

hashAlgorithm.NamenullEmpty

padding 未知,或不支援此實作。

-或-

這個執行個體只表示公開金鑰。

-或-

建立簽章時發生錯誤。

另請參閱

適用於

.NET 10 及其他版本
產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

來源:
RSA.cs
來源:
RSA.cs
來源:
RSA.cs

針對指定雜湊值的簽章,使用指定的填補來計算。

C#
public byte[] SignHash(ReadOnlySpan<byte> hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);

參數

hash
ReadOnlySpan<Byte>

要簽署之資料的雜湊值。

hashAlgorithm
HashAlgorithmName

用來建立 哈希的 hash哈希演算法。

padding
RSASignaturePadding

填補模式。

傳回

Byte[]

指定雜湊值的 RSA 簽章。

例外狀況

padding NamehashAlgorithmnull

hashAlgorithm Name是空字串。

padding 未知,或不支援此實作。

-或-

這個執行個體只表示公開金鑰。

-或-

建立簽章時發生錯誤。

適用於

.NET 10 及其他版本
產品 版本
.NET 7, 8, 9, 10

SignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

來源:
RSA.cs
來源:
RSA.cs
來源:
RSA.cs

使用目前的金鑰簽署哈希,並將簽章寫入提供的緩衝區。

C#
public int SignHash(ReadOnlySpan<byte> hash, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);

參數

hash
ReadOnlySpan<Byte>

要簽署之資料的雜湊值。

destination
Span<Byte>

要接收 RSA 簽章的緩衝區。

hashAlgorithm
HashAlgorithmName

用來建立 哈希的 hash哈希演算法。

padding
RSASignaturePadding

填補模式。

傳回

寫入 destination 的總位元組數。

例外狀況

padding NamehashAlgorithmnull

hashAlgorithm Name是空字串。

-或-

中的 destination 緩衝區太小而無法保存簽章。

padding 未知,或不支援此實作。

-或-

這個執行個體只表示公開金鑰。

-或-

建立簽章時發生錯誤。

適用於

.NET 10 及其他版本
產品 版本
.NET 7, 8, 9, 10