Virgil Security Crypto library  1.8.2
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 Types

Constants
enum  { kPreferredChunkSize = 1024 * 1024 - 1 }
 

Public Member Functions

size_t startEncryption (size_t preferredChunkSize=kPreferredChunkSize)
 Initialize data chunk encryption with given chunk size. More...
 
size_t startDecryptionWithKey (const VirgilByteArray &recipientId, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
 Initialize multipart decryption with given private key. More...
 
size_t startDecryptionWithPassword (const VirgilByteArray &pwd)
 Initialize multipart decryption with given private key. More...
 
VirgilByteArray process (const VirgilByteArray &data)
 Encrypt / Decrypt given data chunk. More...
 
void finish ()
 Finalize encryption or decryption process. More...
 
virtual ~VirgilChunkCipher () throw ()
 Polymorphic destructor.
 
- Public Member Functions inherited from virgil::crypto::VirgilCipherBase
 VirgilCipherBase ()
 Initialize randomization module used by encryption.
 
virtual ~VirgilCipherBase () throw ()
 Dispose used resources.
 
void addKeyRecipient (const VirgilByteArray &recipientId, const VirgilByteArray &publicKey)
 Add recipient defined with id and public key.
 
void removeKeyRecipient (const VirgilByteArray &recipientId)
 Remove recipient with given id. 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.
 
void removePasswordRecipient (const VirgilByteArray &pwd)
 Remove recipient with given password. More...
 
void removeAllRecipients ()
 Remove all recipients.
 
VirgilCustomParamscustomParams ()
 
const VirgilCustomParamscustomParams () const
 Provide readonly access to the object that handles custom parameters. More...
 
VirgilByteArray getContentInfo () const
 Returns encrypted data info. More...
 
void setContentInfo (const VirgilByteArray &contentInfo)
 Create content info object from ASN.1 structure. More...
 

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::VirgilSymmetricCipherinitDecryption (const VirgilByteArray &encryptedDataInfo, const VirgilByteArray &recipientId, const VirgilByteArray &privateKey, const VirgilByteArray &privateKeyPassword=VirgilByteArray())
 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 Enumeration Documentation

anonymous enum
Enumerator
kPreferredChunkSize 

1MiB - 1b for padding

Member Function Documentation

void virgil::crypto::VirgilChunkCipher::finish ( )

Finalize encryption or decryption process.

Note
Call this method after encryption or decryption are done to prevent security issues.
VirgilByteArray virgil::crypto::VirgilChunkCipher::process ( const VirgilByteArray &  data)

Encrypt / Decrypt given data chunk.

Returns
Encrypted / Decrypted data chunk.
size_t virgil::crypto::VirgilChunkCipher::startDecryptionWithKey ( const VirgilByteArray &  recipientId,
const VirgilByteArray &  privateKey,
const VirgilByteArray &  privateKeyPassword = VirgilByteArray() 
)

Initialize multipart decryption with given private key.

Returns
Actual chunk size.
size_t virgil::crypto::VirgilChunkCipher::startDecryptionWithPassword ( const VirgilByteArray &  pwd)

Initialize multipart decryption with given private key.

Returns
Actual chunk size.
size_t virgil::crypto::VirgilChunkCipher::startEncryption ( size_t  preferredChunkSize = kPreferredChunkSize)

Initialize data chunk encryption with given chunk size.

Returns
Actual chunk size.

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