Reputation: 3
Good day!
The task: something like an ebooks store with PDFs which are something like 250-500Mb large. The big question here is its secure storage on the device for offline reading.
The use case: you get the list of books in the table view. You choose one and purchase. Now you have the ability to download it and read offline.
The 2 variants I'm thinking about are: 1) Forget about security and store them in Documents folder of the app. Or in cache folder, maybe. I'm really scared to do that because those, who use jailbreak can get what's there in the folder. And as of statistics it's something like 5-15 percent of all devices. 2) Try to store it encrypted as a blob with Core data.
Are these approaches okey, which to choose, and, maybe, there are some more appropriate variants?
Thank you!
Upvotes: 0
Views: 998
Reputation: 2854
You can make use of RNCryptor's Incremental Usage feature. RNCryptor is a CCCryptor (AES encryption) wrapper for iOS and Mac in Swift. There is also an Objective-C version available.
Incremental Usage allows you to encrypt and decrypt the data in chunks. This is key here, as you wont be able to fit 500 MB into RAM on older devices. Working in chunks will keep your memory footprint low and you should probably be able to achieve your goal this way.
Despite that, 500 MB is still a lot for a mobile device and I think you should try to decrease the file sizes and split up those files into smaller ones. This way they will be much easier to handle.
Upvotes: 1