saoudrizwan / Disk

Delightful framework for iOS to easily persist structs, images, and data
MIT License
3.08k stars 170 forks source link

Is there an encryption option? #75

Closed magua-io closed 4 years ago

magua-io commented 5 years ago

When storing data in .documents, the data itself is not encrypted, and if users try to backup the app by iTunes without the encryption option, the stored data could be viewed directly as the plain text. Is it possible to encrypt the data that stores into the file system by using Disk? Any suggestions? Thanks!

liltimtim commented 4 years ago

Since you can encode the Data and [Data] types, you could make this a step inside your encoding and decoding whereby when you go to save the data, you encrypt it, then store it onto the disk.

Here's an article on how to interact with the built in CommonCrypto Working with CommonCrypto for AES256 Encryption

I would use iOS's keychain to store any encryption and decryption keys, otherwise storing the key on disk would pose the same security issues as not encrypting.