Multi-part decryption, handling the counter

20 views
Skip to first unread message

Hilal Alsibai

unread,
Apr 9, 2013, 5:20:58 PM4/9/13
to cryptop...@googlegroups.com
Hi there,

I'm utilizing Crypto++ in an Android application through the JNI interface. As a side-effect, the C++ portion of my application is never "live", and is somewhat treated like a library of sorts.

This seems to pose a problem for Crypto++.

I'm currently reading in a file, in 16kb chunks, to decrypt. Due to the limited memory on Android devices, it would not be feasible to load the entire file into memory then pass it to Crypto++. So I am attempting to decrypt each block by a standalone decryption function.

My java code would call a native decrypt(buffer, key, counter) function, where in that function Crypto++ would initialize a decryption object and supply it with the key and counter passed in, decrypt the passed in buffer and pass it back.

I'm using AES-CTR and am having trouble keeping the counter valid across all blocks. I noticed the counter is unchanged after PumpAll(), so I'm wondering if there is a way to perform decryption (and encryption for that matter) in a multi-part format that utilizes a standalone function that will not receive all of the data at once.

I tried to utilize the IncrementCounterByOne function on the counter after returning from the native decrypt function for each block processed, but I don't seem to be doing it correctly...

Let me know if I need to explain anything else...

Hilal Alsibai

unread,
Apr 11, 2013, 2:10:34 PM4/11/13
to cryptop...@googlegroups.com
Nevermind, all is well. You do just utilize IncrementCounterByOne. My issue was using the wrong key size (doh).
Reply all
Reply to author
Forward
0 new messages