Dear Crypto++ users,

I am working on a solution which included encryption of files of arbitrary 
size (at least up to 2 GB) to be encrypted with AES CCM and uploaded to a 
server.

The files would need to be encrypted by blocks when uploading not to impose 
a file size limit. Total size of the file can be queries before encrypting 
the data.

The examples on this mailing list and Crypto++ wiki only show hot to 
encrypt the complete message in one call. Examples of AES CCM encryption 
with OpenSSL are similar in that respect.

Is it valid to encrypt large input plaintext (without AAD) block by block 
like this (pseudo code)?

CCM< AES, 8 >::Encryption e;
e.SetKeyWithIV( key, key.size(), iv, sizeof(iv) );

e.SpecifyDataLengths( 0, filesize, 0 );

std::string cipheblock;

AuthenticatedEncryptionFilter ef( e,
    new StringSink( cipherblock )
); // AuthenticatedEncryptionFilter

do {
    std::string pdata;
    // read block of pdata here

    ef.ChannelPut( DEFAULT_CHANNEL, pdata.data(), pdata.size() );
    ef.ChannelMessageEnd(DEFAULT_CHANNEL);

    // upload cipherblock

    cipherblock.clear();
}

ef.MessageEnd();

// upload last cipherblock


Thank you very much for clarification.

Best regards,

Matej

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to