Virgil Security Crypto library  1.8.2
List of all members
virgil::crypto::foundation::VirgilPBE Class Reference

Provides Password-Based Cryptography. Now PKCS#5 and PKCS#12 are partially supported. More...

#include <VirgilPBE.h>

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

Public Types

Constants
enum  { kIterationCountMin = 1024 }
 

Public Member Functions

Constructor / Destructor
 VirgilPBE ()
 Create object with undefined algorithm. More...
 
virtual ~VirgilPBE () throw ()
 Polymorphic destructor.
 
Encryption / Decryption
virgil::crypto::VirgilByteArray encrypt (const virgil::crypto::VirgilByteArray &data, const virgil::crypto::VirgilByteArray &pwd) const
 Encrypt data with given password. More...
 
virgil::crypto::VirgilByteArray decrypt (const virgil::crypto::VirgilByteArray &data, const virgil::crypto::VirgilByteArray &pwd) const
 Decrypt data with given password. More...
 
Copy constructor / assignment operator
Warning
Copy constructor and assignment operator create copy of the object as it was created by on of the creation methods. All changes in the internal state, that was made after creation, are not copied!
 VirgilPBE (const VirgilPBE &other)
 
VirgilPBEoperator= (const VirgilPBE &rhs)
 
VirgilAsn1Compatible implementation
Marshalling format:
PBE ::= AlgorithmIdentifier {{ PBEAlgorithms }}
PBEAlgorithms AlgorithmIdentifier ::= {
{ OID id-PBES2 PARMS PBES2-params } |
{ OID pkcs-12PbeId PARMS pkcs-12PbeParams }
}
virtual size_t asn1Write (virgil::crypto::foundation::asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const
 Write object state to the writer. More...
 
virtual void asn1Read (virgil::crypto::foundation::asn1::VirgilAsn1Reader &asn1Reader)
 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 () throw ()
 Polymorphic destructor.
 

Static Public Member Functions

Creation methods

Object creation with specific hash function.

static VirgilPBE pkcs5 (const virgil::crypto::VirgilByteArray &salt, size_t iterationCount=kIterationCountMin)
 Create object with PKCS#5 parameters for PBE encryption or decryption. More...
 
static VirgilPBE pkcs12 (const virgil::crypto::VirgilByteArray &salt, size_t iterationCount=kIterationCountMin)
 Create object with PKCS#12 parameters for PBE encryption or decryption. More...
 

Additional Inherited Members

- Protected Member Functions inherited from virgil::crypto::foundation::asn1::VirgilAsn1Compatible
virtual void checkAsn1ParamNotEmpty (const virgil::crypto::VirgilByteArray &param, const char *paramName=0) const
 If given parameter is empty exception will be thrown. More...
 

Detailed Description

Provides Password-Based Cryptography. Now PKCS#5 and PKCS#12 are partially supported.

Constructor & Destructor Documentation

virgil::crypto::foundation::VirgilPBE::VirgilPBE ( )

Create object with undefined algorithm.

Warning
SHOULD be used in conjunction with VirgilAsn1Compatible interface, i.e. VirgilPBE pbe = VirgilPBE().fromAsn1(asn1);

Member Function Documentation

virtual void virgil::crypto::foundation::VirgilPBE::asn1Read ( virgil::crypto::foundation::asn1::VirgilAsn1Reader asn1Reader)
virtual

Read object state from the reader.

Parameters
asn1Readerreader payloaded with ASN.1 to be read.

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

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

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::VirgilPBE::decrypt ( const virgil::crypto::VirgilByteArray &  data,
const virgil::crypto::VirgilByteArray &  pwd 
) const

Decrypt data with given password.

Parameters
data- data to decrypt.
pwd- password to use for decryption (max length is 31 byte).
Returns
Decrypted data.
virgil::crypto::VirgilByteArray virgil::crypto::foundation::VirgilPBE::encrypt ( const virgil::crypto::VirgilByteArray &  data,
const virgil::crypto::VirgilByteArray &  pwd 
) const

Encrypt data with given password.

Parameters
data- data to encrypt.
pwd- password to use for encryption (max length is 31 byte).
Returns
Encrypted data.
static VirgilPBE virgil::crypto::foundation::VirgilPBE::pkcs12 ( const virgil::crypto::VirgilByteArray &  salt,
size_t  iterationCount = kIterationCountMin 
)
static

Create object with PKCS#12 parameters for PBE encryption or decryption.

Note
Recommended PKCS#12 parameters are set.
static VirgilPBE virgil::crypto::foundation::VirgilPBE::pkcs5 ( const virgil::crypto::VirgilByteArray &  salt,
size_t  iterationCount = kIterationCountMin 
)
static

Create object with PKCS#5 parameters for PBE encryption or decryption.

Note
Recommended PKCS#5 parameters are set.

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