Generate Hash Key In C
Definition
Computes the signature for the specified hash value.
Overloads
SignHash(Byte[], String) | Computes the signature for the specified hash value. |
SignHash(Byte[], HashAlgorithmName, RSASignaturePadding) | Computes the signature for the specified hash value using the specified padding. |
Computes the signature for the specified hash value.
Parameters
- rgbHash
- Byte[]
The hash value of the data to be signed.
- str
- String
The hash algorithm identifier (OID) used to create the hash value of the data.
Returns
The RSA signature for the specified hash value.
Exceptions
The rgbHash
parameter is null
.
The cryptographic service provider (CSP) cannot be acquired.
/generate-a-new-ssh-key-passphrase.html. -or-
There is no private key.
Examples
The following code example encrypts some data, creates a hash of the encrypted data, and then signs hash with a digital signature.
Generate Hash Key In C 10
Remarks
This method creates a digital signature that is verified using the VerifyHash method.
The valid hash algorithms are SHA1 and MD5. The algorithm identifier can be derived from the hash name by using the MapNameToOID method.
Due to collision problems with SHA1 and MD5, Microsoft recommends a security model based on SHA256 or better.
See also
SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)
Computes the signature for the specified hash value using the specified padding.
Parameters
- hash
- Byte[]
The hash value of the data to be signed.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm name used to create the hash value of the data.
Returns
The RSA signature for the specified hash value.
Exceptions
hashAlgorithm
is null
or Empty.
hash
is null
.
-or-
padding
is null
.
padding
does not equal Pkcs1.