37 #ifndef VIRGIL_CRYPTO_PBKDF_H
38 #define VIRGIL_CRYPTO_PBKDF_H
42 #include <virgil/crypto/VirgilByteArray.h>
43 #include <virgil/crypto/foundation/asn1/VirgilAsn1Compatible.h>
45 namespace virgil {
namespace crypto {
namespace foundation {
50 class VirgilPBKDFImpl;
101 VirgilPBKDF(
const virgil::crypto::VirgilByteArray& salt,
unsigned int iterationCount = kIterationCount_Default);
119 VirgilByteArray
getSalt() const;
169 virgil::crypto::VirgilByteArray
derive(const
virgil::crypto::VirgilByteArray& pwd,
size_t outSize = 0);
195 virgil::crypto::foundation::asn1::VirgilAsn1Writer& asn1Writer,
196 size_t childWrittenBytes = 0) const;
198 virtual
void asn1Read(
virgil::crypto::foundation::asn1::VirgilAsn1Reader& asn1Reader);
204 void checkState() const;
209 void checkRecommendations(const VirgilByteArray& pwd) const;
214 VirgilByteArray salt_;
215 unsigned int iterationCount_;
216 unsigned int iterationCountMin_;
217 bool checkRecommendations_;
Algorithm
Defines specific password based key derivation function algorithm.
Definition: VirgilPBKDF.h:68
unsigned int getIterationCount() const
Return iteration count.
virgil::crypto::VirgilByteArray derive(const virgil::crypto::VirgilByteArray &pwd, size_t outSize=0)
Derive key from the given key material.
VirgilByteArray getSalt() const
Return salt.
void disableRecommendationsCheck()
Ignore security check for used parameters.
static const unsigned int kIterationCount_Default
Default iteration count.
Definition: VirgilPBKDF.h:63
This class provides interface that allow to save and restore object state in the ASN.1 structure.
Definition: VirgilAsn1Compatible.h:59
VirgilPBKDF::Hash getHash() const
Returns underlying digest algorithm.
Defines SHA-384 hash algorithm.
Definition: VirgilPBKDF.h:80
Definition: VirgilAsn1Compatible.h:46
virtual void asn1Read(virgil::crypto::foundation::asn1::VirgilAsn1Reader &asn1Reader)
Read object state from the reader.
No algorithm defined.
Definition: VirgilPBKDF.h:69
virtual ~VirgilPBKDF()
Polymorphic destructor.
VirgilPBKDF::Algorithm getAlgorithm() const
Return current algorithm of the password based key derivation function.
void setAlgorithm(VirgilPBKDF::Algorithm alg)
Set specific algorithm of the password based key derivation function.
Defines SHA1 hash algorithm.
Definition: VirgilPBKDF.h:77
Hash
Defines specific underlying hash algorithm for the password based key derivation function algorithm...
Definition: VirgilPBKDF.h:76
VirgilPBKDF()
Create object with undefined algorithms.
Defines SHA-224 hash algorithm.
Definition: VirgilPBKDF.h:78
Defines SHA-256 hash algorithm.
Definition: VirgilPBKDF.h:79
Defines SHA-512 hash algorithm.
Definition: VirgilPBKDF.h:81
Defines PBKDF2 algorithm (https://www.ietf.org/rfc/rfc2898.txt)
Definition: VirgilPBKDF.h:70
virtual size_t asn1Write(virgil::crypto::foundation::asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const
Write object state to the writer.
void enableRecommendationsCheck()
Involve security check for used parameters.
Provides password based key derivation function.
Definition: VirgilPBKDF.h:57
void setHash(Hash hash)
Set underlying digest algorithm.