Virgil Security Crypto library  2.1.2
Public Types | List of all members
virgil::crypto::foundation::VirgilKDF Class Reference

Provides key derivation function algorithms. More...

#include <VirgilKDF.h>

Inheritance diagram for virgil::crypto::foundation::VirgilKDF:
virgil::crypto::foundation::asn1::VirgilAsn1Compatible

Public Types

enum  Algorithm { Algorithm::KDF1, Algorithm::KDF2 }
 Enumerates possible Key Derivation Function algorithms. More...
 

Public Member Functions

Constructor / Destructor
 VirgilKDF ()
 Create object with undefined algorithm. More...
 
 VirgilKDF (VirgilKDF::Algorithm alg)
 Create object with specific algorithm type.
 
 VirgilKDF (const std::string &name)
 Create object with given algorithm name. More...
 
 VirgilKDF (const char *name)
 Create object with given algorithm name. More...
 
Info

Provide detail information about object.

std::string name () const
 Returns name of the key derivation function. More...
 
Process key derivation
virgil::crypto::VirgilByteArray derive (const virgil::crypto::VirgilByteArray &in, size_t outSize)
 Derive key from the given key material. More...
 
VirgilAsn1Compatible implementation
Marshalling format:
KeyDerivationFunction ::= AlgorithmIdentifier {{ KDFAlgorithms }}
KDFAlgorithms AlgorithmIdentifier ::= {
{ OID id-kdf-kdf1 PARMS HashFunction } |
{ OID id-kdf-kdf2 PARMS HashFunction } ,
... -- additional algorithms ---
}
HashFunction ::= AlgorithmIdentifier {{ HashAlgorithms }}
HashAlgorithms AlgorithmIdentifier ::= {
-- nist identifiers
{ OID id-sha1 PARMS NULL } |
{ OID id-sha256 PARMS NULL } |
{ OID id-sha384 PARMS NULL } |
{ OID id-sha512 PARMS NULL } ,
... -- additional algorithms ---
}
size_t asn1Write (asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const override
 Write object state to the writer. More...
 
void asn1Read (asn1::VirgilAsn1Reader &asn1Reader) override
 Read object state from the reader. More...
 
- Public Member Functions inherited from virgil::crypto::foundation::asn1::VirgilAsn1Compatible
virgil::crypto::VirgilByteArray toAsn1 () const
 Save object state to the ASN.1 structure.
 
void fromAsn1 (const virgil::crypto::VirgilByteArray &asn1)
 Restore object state from the ASN.1 structure.
 
virtual ~VirgilAsn1Compatible () noexcept
 Polymorphic destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from virgil::crypto::foundation::asn1::VirgilAsn1Compatible
virtual void checkRequiredField (const VirgilByteArray &param) const
 If given parameter is empty exception will be thrown. More...
 

Detailed Description

Provides key derivation function algorithms.

Member Enumeration Documentation

Enumerates possible Key Derivation Function algorithms.

Enumerator
KDF1 

KDF Algorithm: KDF1 (ISO-18033-2)

KDF2 

KDF Algorithm: KDF2 (ISO-18033-2)

Constructor & Destructor Documentation

virgil::crypto::foundation::VirgilKDF::VirgilKDF ( )

Create object with undefined algorithm.

Warning
SHOULD be used in conjunction with VirgilAsn1Compatible interface, i.e. VirgilKDF kdf; kdf.fromAsn1(asn1);
virgil::crypto::foundation::VirgilKDF::VirgilKDF ( const std::string &  name)
explicit

Create object with given algorithm name.

Note
Names SHOULD be the identical to the VirgilKDF::Algorithm enumeration.
virgil::crypto::foundation::VirgilKDF::VirgilKDF ( const char *  name)
explicit

Create object with given algorithm name.

Note
Names SHOULD be the identical to the VirgilKDF::Algorithm enumeration.

Member Function Documentation

void virgil::crypto::foundation::VirgilKDF::asn1Read ( asn1::VirgilAsn1Reader asn1Reader)
overridevirtual

Read object state from the reader.

Parameters
asn1Readerreader payloaded with ASN.1 to be read.

Implements virgil::crypto::foundation::asn1::VirgilAsn1Compatible.

size_t virgil::crypto::foundation::VirgilKDF::asn1Write ( asn1::VirgilAsn1Writer asn1Writer,
size_t  childWrittenBytes = 0 
) const
overridevirtual

Write object state to the writer.

Parameters
asn1Writerwriter that should be payloaded by subclasses.
childWrittenBytescount of bytes that was written by subclasses.
Returns
Writen bytes count.

Implements virgil::crypto::foundation::asn1::VirgilAsn1Compatible.

virgil::crypto::VirgilByteArray virgil::crypto::foundation::VirgilKDF::derive ( const virgil::crypto::VirgilByteArray in,
size_t  outSize 
)

Derive key from the given key material.

Parameters
in- input sequence (key material).
outSize- size of the output sequence.
Returns
Output sequence.
std::string virgil::crypto::foundation::VirgilKDF::name ( ) const

Returns name of the key derivation function.

Returns
Name of the key derivation function.

The documentation for this class was generated from the following file: