I'm looking at https://cryptography.io/en/latest/fernet/, and I'm wondering how to use this API if I want to encrypt a lot of data.
I hope that I can simply call encrypt in a loop:
with open('secret.txt', 'rb') as ifh:
with open('encrypted.txt', 'wb') as ofh:
f = Fernet(key)
while True:
buf = ifh.read(BUFSIZE)
if not buf:
break
ofh.write(f.encrypt(buf)))
..but it would be nice to have this offically blessed (and implemented, if it doesn't work like that at the moment).
I'm looking at https://cryptography.io/en/latest/fernet/, and I'm wondering how to use this API if I want to encrypt a lot of data.
I hope that I can simply call encrypt in a loop:
..but it would be nice to have this offically blessed (and implemented, if it doesn't work like that at the moment).