"ValueError: Fernet key must be 32 url-safe base64-encoded bytes." When converting str to fernet key
Advertisements I’m trying to convert a raw string password into a fernet key. This code doesn’t work: # Convert the string to bytes key_bytes = self.PrintPassword.encode() # Base64 encode the bytes base64_encoded_key = base64.urlsafe_b64encode(key_bytes) # Create a Fernet key using the encoded bytes fernet_key = base64.urlsafe_b64decode(base64_encoded_key) self. Fern = Fernet(fernet_key) >Solution : Your string should… Read More "ValueError: Fernet key must be 32 url-safe base64-encoded bytes." When converting str to fernet key