Ask coding questions

← Back to all posts
How can I solve this ValueError? (Fernet Keys must be 32url-safe base64-encoded bytes)
shreyansh2009 (7)

Hello. Everyone!
I want to make a Encryption and Decryption Machine based on Fernet. Encrypter is OK but in Decrypter when I try to input the Key (to decrypt the encrypted message), it is showing the Value error ->

Fernet Keys must be 32url-safe base64-encoded bytes

The whole code is ready except the error I am getting. I have been stuck on this error for last 2 days. Any help would be greatly appreciated.
This is the Screen Shot of the error.


And this is the key I try to input in the terminal

b'46Xjycb7Itwsk5UMUkfrZJ5gxmnpVThejWa7F5-_gdQ='

Please help me!
Thanks!