I am trying to decode my 128-bit AES key in byte format to string to store it in the database. I have tried using Python built-in decode()
with ascii
and utf-8
codecs but I get the following errors:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd9 in position 1: ordinal not in range(128)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x94 in position 2: invalid start byte
I am using cryptography.io library for its implementation.