RSA.VerifyData 方法

定義

驗證數位簽章是否有效。Verifies that a digital signature is valid.

多載

VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的資料計算出雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的資料流計算出雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the specified stream using the specified hash algorithm and padding, and comparing it to the provided signature.

VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的資料計算出雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

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

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的部分位元組陣列計算出資料的雜湊值,便藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the data in a portion of a byte array using the specified hash algorithm and padding, and comparing it to the provided signature.

VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的資料計算出雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

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

參數

data
Byte[]

已簽署的資料。The signed data.

signature
Byte[]

要驗證的簽章資料。The signature data to be verified.

hashAlgorithm
HashAlgorithmName

用來建立該資料雜湊值的雜湊演算法。The hash algorithm used to create the hash value of the data.

padding
RSASignaturePadding

填補模式。The padding mode.

傳回

Boolean

如果簽章有效則為 true,否則為 falsetrue if the signature is valid; otherwise, false.

例外狀況

datanulldata is null.

-或--or- signaturenullsignature is null.

-或--or- paddingnullpadding is null.

hashAlgorithm.NamehashAlgorithm.Name nullEmptyis null or Empty.

padding 未知,或不支援此實作。padding is unknown, or not supported by this implementation.

適用於

VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的資料流計算出雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the specified stream using the specified hash algorithm and padding, and comparing it to the provided signature.

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

參數

data
Stream

已簽署的資料。The signed data.

signature
Byte[]

要驗證的簽章資料。The signature data to be verified.

hashAlgorithm
HashAlgorithmName

用來建立該資料雜湊值的雜湊演算法。The hash algorithm used to create the hash value of the data.

padding
RSASignaturePadding

填補模式。The padding mode.

傳回

Boolean

如果簽章有效則為 true,否則為 falsetrue if the signature is valid; otherwise, false.

例外狀況

datanulldata is null.

-或--or- signaturenullsignature is null.

-或--or- paddingnullpadding is null.

hashAlgorithm.NamehashAlgorithm.Name nullEmptyis null or Empty.

padding 未知,或不支援此實作。padding is unknown, or not supported by this implementation.

適用於

VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的資料計算出雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature.

public:
 virtual bool VerifyData(ReadOnlySpan<System::Byte> data, ReadOnlySpan<System::Byte> signature, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public virtual bool VerifyData (ReadOnlySpan<byte> data, ReadOnlySpan<byte> signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
abstract member VerifyData : ReadOnlySpan<byte> * ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> bool
override this.VerifyData : ReadOnlySpan<byte> * ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> bool
Public Overridable Function VerifyData (data As ReadOnlySpan(Of Byte), signature As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Boolean

參數

data
ReadOnlySpan<Byte>

已簽署的資料。The signed data.

signature
ReadOnlySpan<Byte>

要驗證的簽章資料。The signature data to be verified.

hashAlgorithm
HashAlgorithmName

用來建立該資料雜湊值的雜湊演算法。The hash algorithm used to create the hash value of the data.

padding
RSASignaturePadding

填補模式。The padding mode.

傳回

Boolean

如果簽章有效則為 true,否則為 falsetrue if the signature is valid; otherwise, false.

例外狀況

hashAlgorithm.NamehashAlgorithm.Name nullEmptyis null or Empty.

padding 未知,或不支援此實作。padding is unknown, or not supported by this implementation.

適用於

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

使用指定的雜湊演算法和填補,並和提供的簽章比較,來為指定的部分位元組陣列計算出資料的雜湊值,便藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by calculating the hash value of the data in a portion of a byte array using the specified hash algorithm and padding, and comparing it to the provided signature.

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

參數

data
Byte[]

已簽署的資料。The signed data.

offset
Int32

用來計算雜湊值的起始索引。The starting index at which to compute the hash.

count
Int32

要雜湊的位元組數。The number of bytes to hash.

signature
Byte[]

要驗證的簽章資料。The signature data to be verified.

hashAlgorithm
HashAlgorithmName

用來建立該資料雜湊值的雜湊演算法。The hash algorithm used to create the hash value of the data.

padding
RSASignaturePadding

填補模式。The padding mode.

傳回

Boolean

如果簽章有效則為 true,否則為 falsetrue if the signature is valid; otherwise, false.

例外狀況

datanulldata is null.

-或--or- signaturenullsignature is null.

-或--or- paddingnullpadding is null.

hashAlgorithm.NamehashAlgorithm.Name nullEmptyis null or Empty.

offset 小於零。offset is less than zero.

-或--or- count 小於零。count is less than zero.

-或--or- offset + count - 1 產生的索引超出 data 上限。offset + count - 1 results in an index that is beyond the upper bound of data.

padding 未知,或不支援此實作。padding is unknown, or not supported by this implementation.

適用於