项目作者: StevenSigil

项目描述 :
A useful little program to encrypt/decrypt messages and generate keys.
高级语言: Python
项目地址: git://github.com/StevenSigil/cryptography-fernet-python.git
创建时间: 2021-02-10T19:54:00Z
项目社区:https://github.com/StevenSigil/cryptography-fernet-python

开源协议:MIT License

下载


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:

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

Decrypt a message:

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