Virgil Security Crypto library
2.6.3
|
This class provides common functionality to sign and verify data using Virgil Security keys. More...
#include <VirgilSignerBase.h>
Public Member Functions | |
VirgilSignerBase (foundation::VirgilHash::Algorithm hashAlgorithm=foundation::VirgilHash::Algorithm::SHA384) | |
Create signer with predefined hash function. More... | |
foundation::VirgilHash::Algorithm | getHashAlgorithm () const |
Return hash algorithm that SHOULD be used to calculate digest of the data to be signed. More... | |
VirgilByteArray | signHash (const VirgilByteArray &digest, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray()) |
Create signature over pre-calculated hash. More... | |
bool | verifyHash (const VirgilByteArray &digest, const VirgilByteArray &signature, const VirgilByteArray &publicKey) |
Verify signature over pre-calculated hash. More... | |
Protected Member Functions | |
VirgilByteArray | packSignature (const VirgilByteArray &signature) const |
Pack given signature to the ASN.1 structure. More... | |
VirgilByteArray | unpackSignature (const VirgilByteArray &packedSignature) |
Unpack signature and correspond hash algorithm from the ASN.1 structure. More... | |
This class provides common functionality to sign and verify data using Virgil Security keys.
|
explicit |
Create signer with predefined hash function.
foundation::VirgilHash::Algorithm virgil::crypto::VirgilSignerBase::getHashAlgorithm | ( | ) | const |
Return hash algorithm that SHOULD be used to calculate digest of the data to be signed.
|
protected |
Pack given signature to the ASN.1 structure.
signature | - signature to be wrapped |
VirgilByteArray virgil::crypto::VirgilSignerBase::signHash | ( | const VirgilByteArray & | digest, |
const VirgilByteArray & | privateKey, | ||
const VirgilByteArray & | privateKeyPassword = VirgilByteArray() |
||
) |
Create signature over pre-calculated hash.
digest | - hash digest of the data. |
privateKey | - private key to be used for signature operation. |
privateKeyPassword | - private key password. |
|
protected |
Unpack signature and correspond hash algorithm from the ASN.1 structure.
packedSignature | - signature packed within ASN.1 structure. |
bool virgil::crypto::VirgilSignerBase::verifyHash | ( | const VirgilByteArray & | digest, |
const VirgilByteArray & | signature, | ||
const VirgilByteArray & | publicKey | ||
) |
Verify signature over pre-calculated hash.
digest | - hash digest of the data. |
signature | - signature. |
publicKey | - public key to be used for signature verification. |