37 #ifndef VIRGIL_CRYPTO_VIRGIL_PBE_H
38 #define VIRGIL_CRYPTO_VIRGIL_PBE_H
42 #include <virgil/crypto/VirgilByteArray.h>
43 #include <virgil/crypto/foundation/asn1/VirgilAsn1Compatible.h>
45 namespace virgil {
namespace crypto {
namespace foundation {
64 kIterationCountMin = 1024
77 static VirgilPBE pkcs5(
const virgil::crypto::VirgilByteArray& salt,
size_t iterationCount = kIterationCountMin);
83 static VirgilPBE pkcs12(
const virgil::crypto::VirgilByteArray& salt,
size_t iterationCount = kIterationCountMin);
111 virgil::crypto::VirgilByteArray
encrypt(
112 const virgil::crypto::VirgilByteArray& data,
113 const virgil::crypto::VirgilByteArray& pwd)
const;
121 virgil::crypto::VirgilByteArray
decrypt(
122 const virgil::crypto::VirgilByteArray& data,
123 const virgil::crypto::VirgilByteArray& pwd)
const;
150 size_t childWrittenBytes = 0)
const;
159 explicit VirgilPBE(
int type,
const virgil::crypto::VirgilByteArray& salt,
size_t iterationCount);
164 void checkState()
const;
169 virgil::crypto::VirgilByteArray process(
170 const virgil::crypto::VirgilByteArray& data,
171 const virgil::crypto::VirgilByteArray& pwd,
int mode)
const;
174 VirgilPBEImpl* impl_;
static VirgilPBE pkcs5(const virgil::crypto::VirgilByteArray &salt, size_t iterationCount=kIterationCountMin)
Create object with PKCS#5 parameters for PBE encryption or decryption.
This class provides methods for reading ASN.1 data structure.
Definition: VirgilAsn1Reader.h:53
Provides Password-Based Cryptography. Now PKCS#5 and PKCS#12 are partially supported.
Definition: VirgilPBE.h:57
This class provides interface that allow to save and restore object state in the ASN.1 structure.
Definition: VirgilAsn1Compatible.h:59
This class provides methods for writing ASN.1 data structure.
Definition: VirgilAsn1Writer.h:54
Definition: VirgilAsn1Compatible.h:46
VirgilPBE()
Create object with undefined algorithm.
virtual void asn1Read(virgil::crypto::foundation::asn1::VirgilAsn1Reader &asn1Reader)
Read object state from the reader.
virgil::crypto::VirgilByteArray encrypt(const virgil::crypto::VirgilByteArray &data, const virgil::crypto::VirgilByteArray &pwd) const
Encrypt data with given password.
virgil::crypto::VirgilByteArray decrypt(const virgil::crypto::VirgilByteArray &data, const virgil::crypto::VirgilByteArray &pwd) const
Decrypt data with given password.
static VirgilPBE pkcs12(const virgil::crypto::VirgilByteArray &salt, size_t iterationCount=kIterationCountMin)
Create object with PKCS#12 parameters for PBE encryption or decryption.
virtual ~VirgilPBE()
Polymorphic destructor.
virtual size_t asn1Write(virgil::crypto::foundation::asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const
Write object state to the writer.