Skip to content

A useful little program to encrypt/decrypt messages and generate keys.

License

Notifications You must be signed in to change notification settings

StevenSigil/cryptography-fernet-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cryptography via Fernet in Python

A useful little program to encrypt/decrypt messages and generate keys.

A simple, class based, wrapper for the Fernet Cryptography module. Fernet encryption is one of the most secure ways to encrypt a message. Per the documentation, the only way to read the message is to have the secret key.

You can find more information about the encryption method here.

Installation instructions for the Cryptography package found at https://cryptography.io/en/latest/installation.html


Usage

Create an encrypted message:

secret = Cryptography()
message = secret.encrypt_message('Highly classified message!')

Decrypt a message:

  • You will need the secret key that encoded the message stored in a file
secret = Cryptography('secret.key')
message = b'gAAAAABgJDybBjk_n-KXci4Ri8w_y1s1QN3yehVymhAP4hlgrf_marbifFko0Ynvs_xgX2ZOpLEo7Gmj7fUDsQizcyNaR3uX5cSsFntVXCOPy0_XmO5_k04='
message = secret.decrypt_message(message)
print(message)
  # Highly classified message!

About

A useful little program to encrypt/decrypt messages and generate keys.

Topics

Resources

License

Stars

Watchers

Forks

Languages