Encrypt and decrypt bytes instead of str
key.decrypt_seal
cannot handle decrypted binary data because it uses str
instead of bytes
. For example:
e = pubkey.encrypt_seal(b"Hello\xebHello") # no error
d = privkey.decrypt_seal(e) # error
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 5: invalid continuation byte
It should be possible to encrypt/decrypt binary contents.