DSACryptoServiceProvider.VerifyHash(Byte[], String, Byte[]) 方法

定义

通过将指定的签名数据与为指定哈希值计算的签名进行比较来验证指定的签名数据。Verifies the specified signature data by comparing it to the signature computed for the specified hash value.

public:
 bool VerifyHash(cli::array <System::Byte> ^ rgbHash, System::String ^ str, cli::array <System::Byte> ^ rgbSignature);
public bool VerifyHash (byte[] rgbHash, string str, byte[] rgbSignature);
member this.VerifyHash : byte[] * string * byte[] -> bool
Public Function VerifyHash (rgbHash As Byte(), str As String, rgbSignature As Byte()) As Boolean

参数

rgbHash
Byte[]

待签名数据的哈希值。The hash value of the data to be signed.

str
String

用于创建数据的哈希值的哈希算法名称。The name of the hash algorithm used to create the hash value of the data.

rgbSignature
Byte[]

要验证的签名数据。The signature data to be verified.

返回

如果签名验证为有效,则为 true;否则,为 falsetrue if the signature verifies as valid; otherwise, false.

异常

rgbHash 参数为 nullThe rgbHash parameter is null.

-or- rgbSignature 参数为 nullThe rgbSignature parameter is null.

无法获取加密服务提供程序 (CSP)。The cryptographic service provider (CSP) cannot be acquired.

-or-

不能验证签名。The signature cannot be verified.

注解

此方法验证DSA SignHash生成的数字签名。This method verifies the DSA digital signature produced by SignHash.

如果参数为null,则使用默认哈希算法(SHA1)。 strIf the str parameter is null, the default hash algorithm (SHA1) is used. 有效的哈希算法SHA1为。The valid hash algorithms is SHA1.

由于 SHA1 出现冲突问题,Microsoft 建议使用基于 SHA256 或更好的安全模型。Due to collision problems with SHA1, Microsoft recommends a security model based on SHA256 or better.

适用于

另请参阅