Virgil Security Crypto library  2.4.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
VirgilSignerBase.h
1 
37 #ifndef VIRGIL_CRYPTO_SIGNER_BASE_H
38 #define VIRGIL_CRYPTO_SIGNER_BASE_H
39 
40 #include "VirgilByteArray.h"
41 #include "foundation/VirgilHash.h"
42 #include "foundation/VirgilAsymmetricCipher.h"
43 
44 namespace virgil { namespace crypto {
45 
50 public:
55  explicit VirgilSignerBase(
57 
63 
73  const VirgilByteArray& digest, const VirgilByteArray& privateKey,
74  const VirgilByteArray& privateKeyPassword = VirgilByteArray());
75 
84  bool verifyHash(
85  const VirgilByteArray& digest, const VirgilByteArray& signature,
86  const VirgilByteArray& publicKey);
87 
88 protected:
103  VirgilByteArray packSignature(const VirgilByteArray& signature) const;
104 
120  VirgilByteArray unpackSignature(const VirgilByteArray& packedSignature);
121 
122 private:
126  virtual VirgilByteArray doSignHash(
127  const VirgilByteArray& digest, const VirgilByteArray& privateKey,
128  const VirgilByteArray& privateKeyPassword);
129 
133  virtual bool doVerifyHash(
134  const VirgilByteArray& digest, const VirgilByteArray& signature, const VirgilByteArray& publicKey);
135 
136 private:
139 };
140 
141 }}
142 
143 #endif /* VIRGIL_CRYPTO_SIGNER_BASE_H */
Algorithm
Enumerates possible Hash algorithms.
Definition: VirgilHash.h:57
bool verifyHash(const VirgilByteArray &digest, const VirgilByteArray &signature, const VirgilByteArray &publicKey)
Verify signature over pre-calculated hash.
Provides asymmetric ciphers algorithms (PK).
Definition: VirgilAsymmetricCipher.h:52
Provides hashing (message digest) algorithms.
Definition: VirgilHash.h:52
This class provides common functionality to sign and verify data using Virgil Security keys...
Definition: VirgilSignerBase.h:49
VirgilByteArray packSignature(const VirgilByteArray &signature) const
Pack given signature to the ASN.1 structure.
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:50
VirgilByteArray unpackSignature(const VirgilByteArray &packedSignature)
Unpack signature and correspond hash algorithm from the ASN.1 structure.
VirgilByteArray signHash(const VirgilByteArray &digest, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
Create signature over pre-calculated hash.
foundation::VirgilHash::Algorithm getHashAlgorithm() const
Return hash algorithm that SHOULD be used to calculate digest of the data to be signed.
VirgilSignerBase(foundation::VirgilHash::Algorithm hashAlgorithm=foundation::VirgilHash::Algorithm::SHA384)
Create signer with predefined hash function.