diff --git a/puren_tonbo/__init__.py b/puren_tonbo/__init__.py index 1047e26..84a686a 100644 --- a/puren_tonbo/__init__.py +++ b/puren_tonbo/__init__.py @@ -665,13 +665,15 @@ def read_from(self, file_object): return plaintext def write_to(self, file_object, byte_data): + # TODO catch exceptions and raise PurenTonboException() + # TODO AsciiArmoredInput() password = self.key if not isinstance(password, bytes): password = password.decode("utf-8") - raise NotImplementedError - crypted_bytes = b'TODO' - file_object.write(crypted_bytes) + identities = [age.keys.password.PasswordKey(password)] + with age.file.Encryptor(identities, file_object) as encryptor: + encryptor.write(byte_data) # TODO AE-2 (no CRC), otherwise the same as AE-1 - see https://github.com/clach04/puren_tonbo/wiki/zip-format class ZipEncryptedFileBase(EncryptedFile):