Hi all,
In my app I have an option for users to create a PDF of their data. I'd like them to be able to save the pdf to a flashdrive or hard disk, but in encrypted form. Is it possibe with CryptoKit? Messing about in playground I've been trying to encrypt a plain string, but I get the error message that String doesn't conform to DataProtocol. How do I need to package the string in order to successfully pass it into the function?
let key = SymmetricKey(size: .bits256)
let contents = try String(contentsOfFile: filePath.path)
let data = contents
let encryptedData = data
let sealedBox = try? ChaChaPoly.seal(encryptedData, using: key)