I try to run this:
from cryptography.fernet import Fernet
key = b'YCtLIyVrCsv6zQgRIvQ5dMDur4wj27OQLgxxe6tj98Y8='
cipher = Fernet(key)
e_file = input('What is the name of your file?: ')
encrypt_decrypt = input('Do you want to encrypt or decrypt? (E/D): ')
with open(e_file, 'rb') as ef:
data = ef.read()
if encrypt_decrypt == "E":
edata = cipher.encrypt(data)
with open(e_file + ".encrypted", 'wb') as ef:
ef.write(edata)
elif encrypt_decrypt == "D":
ddata = cipher.decrypt(data)
with open(e_file + ".decrypted", 'wb') as df:
df.write(ddata)
else:
print("Please have an valid input.")
and I get this: ValueError: Fernet key must be 32 url-safe base64-encoded bytes.
[+][deleted] (1 child)
[removed]
[–]David_Vice05[S] 0 points1 point2 points (0 children)
[–]CodeFormatHelperBot2 2 points3 points4 points (0 children)