RSA.SignData 方法

定義

計算指定資料的雜湊值並進行簽署。

多載

SignData(Byte[], HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的位元組陣列計算出雜湊值。

SignData(Stream, HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的資料流計算出雜湊值。

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

計算指定資料的雜湊值並進行簽署。

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

使用指定的演算法計算所提供資料的雜湊,並使用目前的金鑰簽署雜湊,並將簽章寫入提供的緩衝區。

SignData(Byte[], Int32, Int32, HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的部分位元組陣列計算出雜湊值。

SignData(Byte[], HashAlgorithmName, RSASignaturePadding)

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

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的位元組陣列計算出雜湊值。

public:
 cli::array <System::Byte> ^ SignData(cli::array <System::Byte> ^ data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public byte[] SignData (byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
member this.SignData : byte[] * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
Public Function SignData (data As Byte(), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()

參數

data
Byte[]

要雜湊處理和簽章的輸入資料。

hashAlgorithm
HashAlgorithmName

要用來建立雜湊值的雜湊演算法。

padding
RSASignaturePadding

填補模式。

傳回

Byte[]

指定資料的 RSA 簽章。

例外狀況

datanull

-或-

paddingnull

hashAlgorithm.NamenullEmpty

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

-或-

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

-或-

建立簽章時發生錯誤。

另請參閱

適用於

SignData(Stream, HashAlgorithmName, RSASignaturePadding)

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

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的資料流計算出雜湊值。

public:
 virtual cli::array <System::Byte> ^ SignData(System::IO::Stream ^ data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public virtual byte[] SignData (System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
abstract member SignData : System.IO.Stream * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
override this.SignData : System.IO.Stream * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
Public Overridable Function SignData (data As Stream, hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()

參數

data
Stream

要雜湊處理和簽章的輸入輸入資料流。

hashAlgorithm
HashAlgorithmName

要用來建立雜湊值的雜湊演算法。

padding
RSASignaturePadding

填補模式。

傳回

Byte[]

指定資料的 RSA 簽章。

例外狀況

datanull

-或-

paddingnull

hashAlgorithm.NamenullEmpty

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

-或-

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

-或-

建立簽章時發生錯誤。

另請參閱

適用於

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

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

計算指定資料的雜湊值並進行簽署。

public:
 cli::array <System::Byte> ^ SignData(ReadOnlySpan<System::Byte> data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public byte[] SignData (ReadOnlySpan<byte> data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
member this.SignData : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
Public Function SignData (data As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()

參數

data
ReadOnlySpan<Byte>

要雜湊處理和簽章的輸入資料。

hashAlgorithm
HashAlgorithmName

要用來建立雜湊值的雜湊演算法。

padding
RSASignaturePadding

填補模式。

傳回

Byte[]

指定資料的 RSA 簽章。

例外狀況

paddingNamehashAlgorithmnull

hashAlgorithmName是空字串。

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

-或-

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

-或-

建立簽章時發生錯誤。

適用於

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

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

使用指定的演算法計算所提供資料的雜湊,並使用目前的金鑰簽署雜湊,並將簽章寫入提供的緩衝區。

public:
 int SignData(ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public int SignData (ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
member this.SignData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> int
Public Function SignData (data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Integer

參數

data
ReadOnlySpan<Byte>

要雜湊處理和簽章的輸入資料。

destination
Span<Byte>

要接收 RSA 簽章的緩衝區。

hashAlgorithm
HashAlgorithmName

要用來建立雜湊值的雜湊演算法。

padding
RSASignaturePadding

填補模式。

傳回

寫入 destination 的總位元組數。

例外狀況

paddingNamehashAlgorithmnull

hashAlgorithmName是空字串。

-或-

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

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

-或-

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

-或-

建立簽章時發生錯誤。

適用於

SignData(Byte[], Int32, Int32, HashAlgorithmName, RSASignaturePadding)

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

使用指定的雜湊演算法和填補模式,並簽署產生的雜湊值,來為指定的部分位元組陣列計算出雜湊值。

public:
 virtual cli::array <System::Byte> ^ SignData(cli::array <System::Byte> ^ data, int offset, int count, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public virtual byte[] SignData (byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
abstract member SignData : byte[] * int * int * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
override this.SignData : byte[] * int * int * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> byte[]
Public Overridable Function SignData (data As Byte(), offset As Integer, count As Integer, hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Byte()

參數

data
Byte[]

要雜湊處理和簽章的輸入資料。

offset
Int32

這個陣列中的位移,在此處開始使用資料。

count
Int32

陣列中要用作資料的位元組數目。

hashAlgorithm
HashAlgorithmName

要用來建立雜湊值的雜湊演算法。

padding
RSASignaturePadding

填補模式。

傳回

Byte[]

指定資料的 RSA 簽章。

例外狀況

datanull

-或-

paddingnull

hashAlgorithm.NamenullEmpty

offset 小於零。

-或-

count 小於零。

-或-

offset + count - 1 產生的索引超出 data 上限。

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

-或-

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

-或-

建立簽章時發生錯誤。

另請參閱

適用於