Virgil Security Crypto library  2.4.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
virgil::crypto::VirgilChunkCipher Class Reference

This class provides high-level interface to encrypt / decrypt data splitted to chunks. More...

#include <VirgilChunkCipher.h>

Inheritance diagram for virgil::crypto::VirgilChunkCipher:
virgil::crypto::VirgilCipherBase

Public Member Functions

void encrypt (VirgilDataSource &source, VirgilDataSink &sink, bool embedContentInfo=true, size_t preferredChunkSize=kPreferredChunkSize)
 Encrypt data read from given source and write it the sink. More...
 
void decryptWithKey (VirgilDataSource &source, VirgilDataSink &sink, const VirgilByteArray &recipientId, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
 Decrypt data read from given source for recipient defined by id and private key, and write it to the sink. More...
 
void decryptWithPassword (VirgilDataSource &source, VirgilDataSink &sink, const VirgilByteArray &pwd)
 Decrypt data read from given source for recipient defined by password, and write it to the sink. More...
 
- Public Member Functions inherited from virgil::crypto::VirgilCipherBase
 VirgilCipherBase ()
 Initialize submodules.
 
void addKeyRecipient (const VirgilByteArray &recipientId, const VirgilByteArray &publicKey)
 Add recipient defined with id and public key. More...
 
void removeKeyRecipient (const VirgilByteArray &recipientId)
 Remove recipient with given identifier. More...
 
bool keyRecipientExists (const VirgilByteArray &recipientId) const
 Check whether recipient with given identifier exists. More...
 
void addPasswordRecipient (const VirgilByteArray &pwd)
 Add recipient defined with password. More...
 
void removePasswordRecipient (const VirgilByteArray &pwd)
 Remove recipient with given password. More...
 
bool passwordRecipientExists (const VirgilByteArray &password) const
 Check whether recipient with given password exists. More...
 
void removeAllRecipients ()
 Remove all recipients.
 
VirgilCustomParamscustomParams ()
 Provide access to the object that handles custom parameters. More...
 
const VirgilCustomParamscustomParams () const
 Provide readonly access to the object that handles custom parameters. More...
 
VirgilByteArray getContentInfo () const
 Return content info. More...
 
void setContentInfo (const VirgilByteArray &contentInfo)
 Create content info object from ASN.1 structure. More...
 

Static Public Attributes

Constants
static constexpr size_t kPreferredChunkSize = 1024 * 1024
 Recommended chunk size.
 

Additional Inherited Members

- Static Public Member Functions inherited from virgil::crypto::VirgilCipherBase
static VirgilByteArray computeShared (const VirgilByteArray &publicKey, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
 Compute shared secret key on a given keys. More...
 
static size_t defineContentInfoSize (const VirgilByteArray &data)
 Read content info size as part of the data. More...
 
- Protected Member Functions inherited from virgil::crypto::VirgilCipherBase
VirgilByteArray tryReadContentInfo (const VirgilByteArray &encryptedData)
 Make attempt to read content info from the encrypted data. More...
 
virgil::crypto::foundation::VirgilSymmetricCipherinitEncryption ()
 Configures symmetric cipher for encryption. More...
 
virgil::crypto::foundation::VirgilSymmetricCipherinitDecryptionWithPassword (const VirgilByteArray &pwd)
 Configures symmetric cipher for decryption based on the recipient's password. More...
 
virgil::crypto::foundation::VirgilSymmetricCipherinitDecryptionWithKey (const VirgilByteArray &recipientId, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword)
 Configures symmetric cipher for decryption based on the recipient's id and private key. More...
 
virgil::crypto::foundation::VirgilSymmetricCiphergetSymmetricCipher ()
 Return symmetric cipher configure by one of the methods: initEncryption(), initDecryptionWithPassword(), initDecryptionWithKey.
 
void buildContentInfo ()
 Build VirgilContentInfo object. More...
 
void clearCipherInfo ()
 Clear all information related to the cipher. More...
 

Detailed Description

This class provides high-level interface to encrypt / decrypt data splitted to chunks.

Note
Virgil Security keys is used for encryption and decryption.
This class algorithms are not compatible with VirgilCipher and VirgilStreamCipher class algorithms.

Member Function Documentation

void virgil::crypto::VirgilChunkCipher::decryptWithKey ( VirgilDataSource source,
VirgilDataSink sink,
const VirgilByteArray recipientId,
const VirgilByteArray privateKey,
const VirgilByteArray privateKeyPassword = VirgilByteArray() 
)

Decrypt data read from given source for recipient defined by id and private key, and write it to the sink.

Note
Content info MUST be defined, if it was not embedded to the encrypted data.
See Also
method setContentInfo().
void virgil::crypto::VirgilChunkCipher::decryptWithPassword ( VirgilDataSource source,
VirgilDataSink sink,
const VirgilByteArray pwd 
)

Decrypt data read from given source for recipient defined by password, and write it to the sink.

Note
Content info MUST be defined, if it was not embedded to the encrypted data.
See Also
method setContentInfo().
void virgil::crypto::VirgilChunkCipher::encrypt ( VirgilDataSource source,
VirgilDataSink sink,
bool  embedContentInfo = true,
size_t  preferredChunkSize = kPreferredChunkSize 
)

Encrypt data read from given source and write it the sink.

Parameters
source- source of the data to be encrypted.
sink- target sink for encrypted data.
preferredChunkSize- chunk size that will appropriate.
embedContentInfo- determines whether to embed content info the the encrypted data, or not.
Note
Store content info to use it for before decription process in future, if embedContentInfo parameter is false getContentInfo().

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