Thanks heaps. I have it running nicely in the playground. I spent quite a bit of time going down a few deadends trying to work out how to save it, until I cottoned on to saving it as Data. I hope you don't mind if I ask a few more questions.I've saved it this way:let filename = getDocumentsDirectory().appendingPathComponent("backup.txt")//Write to filedo { let e = Data(encryptedData.combined!) try e.write(to: filename)Is saving it to a standard .txt file okay?Also, for arguments sake, if the salt and rounds needed to be hidden, how would that be handled? I don't know anything about what happens when an app is installed, but I imagine the salt and rounds could be stored in a file and then, during installation, written to the keychain while the file is deleted, or would that be insecure? I guess that any values that required high security could be encrypted and then unencrypted during the installation process for passing into the keychain.Sorry for so many questions, but I have one more. I know that the iPhone is encrypted as a whole, but if I wanted to have encryption on top of that, within my app, is cryptokit suitable for implementing that, or would common crypto be the better option?
Post
Replies
Boosts
Views
Activity
I think I've got the logic of it now. Because I'm a bit slow, could you please correct me if I have this wrong.1. A key is derived from a password.2. It's used to encrypt the textfile.3. It can then be gotten rid of, because when it comes to decryption the same key will be derived from password input again and used to decrypt the file?
Thanks heaps, Eskimo. I'll take a look at it all and see if I can nut it out. I'm very much a novice, so I may have some more questions after I've tackled what you've given me.Cheers