Skip to content Skip to sidebar Skip to footer

Error (cryptography.fernet.invalidtoken) In Simple Password-program

I'm writing a simple password program in Python (new to Python, even newer to encryption), where user accounts and passwords gets saved in a dictionary to a file. I'm encrypting th

Solution 1:

If my understanding is right, you are passing to the decrypt method the encoded value of the crypted text, which is not a valid token to decrypt.

Since you pass a encoded value to the crypt, the decrypt should be something like this:

defdecrypt(token):
    return base64.decode(cipher_suite.decrypt(token, encoding="ascii"))

Post a Comment for "Error (cryptography.fernet.invalidtoken) In Simple Password-program"