Marius
Marius

Reputation: 4016

Encrypting data in chunks

Some time ago i've asked in this forum how i could encrypt a large file on an iphone without loading them entirely into memory. Didn't get an answer though. I didn't want to load megabytes of data to ram only to encrypt them again ... in ram. iDevices have very limited ram so i wanted the encryption engine to encrypt files instead of in-memory data, not loading the entire file to memory. I am not an expert in objective-c so i did not find a way to do this usin Security.framework. Instead, i wrote a class that reads a source file in specified size chunks, encrypts them and writes to a destination file. This way i'm not reading an entire file into memory so that solves my problem. However ... does that raise another completely different problem? Does the encryption suffer if i split the file in N parts, encrypt those parts separately and then join the result into an encrypted file? I have virtually no knowledge in cryptography so i want to make sure if my approach does not compromise the cryptography algorithm (i'm using AES 128bit).

Thanks for sharing your thoughts

Upvotes: 0

Views: 407

Answers (1)

Fruity Geek
Fruity Geek

Reputation: 7381

The encryption of a file does not suffer from being done in chunks because the encryption is ALWAYS done in small chunks. AES (what you seemed to be using in your prior question) has a chunk size of 128 bits.

Upvotes: 1

Related Questions