Virgil Security Crypto library  2.0.7
VirgilKDF.h
1 
37 #ifndef VIRGIL_CRYPTO_KDF_H
38 #define VIRGIL_CRYPTO_KDF_H
39 
40 #include <string>
41 #include <memory>
42 
43 #include <virgil/crypto/VirgilByteArray.h>
44 #include <virgil/crypto/foundation/asn1/VirgilAsn1Compatible.h>
45 
46 namespace virgil { namespace crypto { namespace foundation {
47 
53 public:
57  enum class Algorithm {
58  KDF1,
59  KDF2
60  };
64 
70  VirgilKDF();
71 
75  explicit VirgilKDF(VirgilKDF::Algorithm alg);
76 
81  explicit VirgilKDF(const std::string& name);
82 
87  explicit VirgilKDF(const char* name);
89 
96 
101  std::string name() const;
103 
106 
116 
138  size_t asn1Write(asn1::VirgilAsn1Writer& asn1Writer, size_t childWrittenBytes = 0) const override;
140 
141  void asn1Read(asn1::VirgilAsn1Reader& asn1Reader) override;
143 public:
145  VirgilKDF(VirgilKDF&& rhs) noexcept;
146 
147  VirgilKDF& operator=(VirgilKDF&& rhs) noexcept;
148 
149  virtual ~VirgilKDF() noexcept;
151 
152 private:
156  void checkState() const;
157 
158 private:
159  class Impl;
160 
161  std::unique_ptr<Impl> impl_;
162 };
163 
164 }}}
165 
166 namespace std {
173 }
174 
175 #endif /* VIRGIL_CRYPTO_KDF_H */
Algorithm
Enumerates possible Key Derivation Function algorithms.
Definition: VirgilKDF.h:57
void asn1Read(asn1::VirgilAsn1Reader &asn1Reader) override
Read object state from the reader.
This class provides methods for reading ASN.1 data structure.
Definition: VirgilAsn1Reader.h:53
std::string name() const
Returns name of the key derivation function.
Provides key derivation function algorithms.
Definition: VirgilKDF.h:52
This class provides interface that allow to save and restore object state in the ASN.1 structure.
Definition: VirgilAsn1Compatible.h:59
Definition: VirgilHash.h:252
This class provides methods for writing ASN.1 data structure.
Definition: VirgilAsn1Writer.h:54
string to_string(virgil::crypto::foundation::VirgilKDF::Algorithm alg)
Returns string representation of the KDF algorithm.
Root namespace for all Virgil Security libraries.
Definition: VirgilAsn1Compatible.h:46
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:53
size_t asn1Write(asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const override
Write object state to the writer.
VirgilKDF()
Create object with undefined algorithm.
virgil::crypto::VirgilByteArray derive(const virgil::crypto::VirgilByteArray &in, size_t outSize)
Derive key from the given key material.