Check the Secret validity

The API lets you create an invalid fernet secret. This PR fixes that.