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)