語言

RSA.TrySignData 方法

定義

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

public:
 virtual bool TrySignData(ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding, [Runtime::InteropServices::Out] int % bytesWritten);
public virtual bool TrySignData(ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding, out int bytesWritten);
abstract member TrySignData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding * int -> bool
override this.TrySignData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding * int -> bool
Public Overridable Function TrySignData (data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding, ByRef bytesWritten As Integer) As Boolean

參數

data
ReadOnlySpan<Byte>

輸入資料要雜湊和簽名。

destination
Span<Byte>

接收 RSA 簽名的緩衝區。

hashAlgorithm
HashAlgorithmName

用來產生資料雜湊值的雜湊演算法。

padding
RSASignaturePadding

填充模式。

bytesWritten
Int32

當此方法回傳時,包含寫入 destination的總位元組數。 此參數被視為未初始化。

傳回

true如果 destination 足夠長以接收 RSA 簽名;否則,。 false

例外狀況

padding 是 null。

hashAlgorithm。Name 是 null 或 Empty。

此實例僅代表公鑰。

-或-

建立簽名時發生錯誤。

備註

RSA 簽章演算法總是會產生等於位 KeySize 元所需位元組數的輸出。

適用於

另請參閱