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

定义

通过用私钥对其进行加密来计算指定哈希值的签名。Computes the signature for the specified hash value by encrypting it with the private key.

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

参数

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.

返回

Byte[]

指定哈希值的 DSA 签名。The DSA signature for the specified hash value.

异常

rgbHash 参数为 nullThe rgbHash parameter is null.

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

-or-

没有私钥。There is no private key.

注解

此方法创建使用VerifyHash方法进行验证的数字签名。This method creates a digital signature that is verified using the VerifyHash method.

DSASHA1使用哈希算法。DSA uses the SHA1 hash algorithm.

安全性

KeyContainerPermissionAccessEntryCollection
用于使用密钥对文件进行签名的权限。for permission to sign a file using the key. 安全操作: DemandSecurity action: Demand. 关联的枚举:SignAssociated enumeration: Sign

适用于

另请参阅