CryptoKit - AES.GCM - How do I encrypt a stream written to disk ( Looking for CipherStream basically)

Hi All.

I have a need to store encrypted data on device. The data is arriving from multiple services in our app in the form of one line of text at a time. This data has to be decrypted on a server, probably using Java.

In Java, there is concept of a CipherStream. I'll init that stream with a private key and IV (nonce), and feed it data as I get it. Once done, I can close the stream, and I have an encrypted file.

In IOS, I'm trying to emulate that process. However, the concept of SealedBox seems to be getting in the way. I can seal each piece of text, but decrypting those doesn't work. I believe this has to do with the way the data is produced by the box. I can decrypt each piece individually, but I can't find a way to feed this into a stream and ultimately seal the whole thing.

I understand I can write the file plain text, and encrypt it at the end, but this leaves the data vulnerable for long periods of time.

Anyone has any Ideas on how to solve this on IOS?

Replies

CryptoKit does not have a streaming interface )-: See this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"