Wrapper for Crypto library to get encrytped key and data using less code and less complexity.
Project description
Crypto Aes GCM
CryptoAesGcm package is a Wrapper for Cypto.Aes package and makes encryption and decryption easier.
Links to understand basics of AES and GCM algorithms:
- https://acodez.in/data-encryption-algorithms/
- https://www.tutorialspoint.com/cryptography/block_cipher.html
- https://www.tutorialspoint.com/cryptography/advanced_encryption_standard.html.
what you can do:
- Generate Encryption Key
- Using Encryption Key, Encrypt string and get O/P in json/concat String format
- Decrypt already encrypted string back to plain text format
Installation
pip install CryptoAesGcm
Usage
Example - Generate Key :
>>> from CryptoAesGcm import AES_GCM_CreateSaveKey
# pass location where you want key to saved at
>>> print(AES_GCM_CreateSaveKey(key_location,No_bytes=32)) # by default No_bytes = 32
True
Example - Encrypt text:
>>> from CryptoAesGcm import AES_GCM_EncryptData
# for ret_type = "json"
>>> ret = AES_GCM_EncryptData("Random text data","key.bin",ret_type = "json") # by default ret_type = "concat")
>>> print(ret)
(True, '{"nonce": "plgyFSJ3+DCQdsVT/T+Nsg==", "ciphertext": "1iMBFpaJoDmuT3LgtYsbz79MPYRMbQ==", "tag": "T3Ivn95YHSK8Z25VXT0+zQ=="}')
# for default ret_type = "concat"
>>> ret = AES_GCM_EncryptData("Random text data","key.bin")
>>> print(ret)
(True, '1f8GuiS+Tn2X1rKKryDth0B96RkLBFl+vSX2TfqdW6/yTjgOVJDKF2RmyfQO5q5YI2IhK/ru')
Example - Decrypt text:
>>> from CryptoAesGcm import AES_GCM_DecryptData
# you can pass both concatinated and json format as input
# function will itself find the best way to decrypt and return the O/P
>>> ret = AES_GCM_DecryptData("encrypted text","key.bin")
>>> print(ret)
(True, 'Random text data')
Note: Function returns tuple if code fails to execute 1st element will be False else it will be True.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file CryptoAesGcm-0.0.7.tar.gz.
File metadata
- Download URL: CryptoAesGcm-0.0.7.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/None requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fecdc8c9bad377e8addee97128a35887a6b927ec4367dfde47c41b1b7e89c9f
|
|
| MD5 |
5d86936052aae58b0bc2de604874cbee
|
|
| BLAKE2b-256 |
f09e07553a17f300cf611fb3d8b56992d853b4727751ac299a43be6bd1d9d84d
|
File details
Details for the file CryptoAesGcm-0.0.7-py3-none-any.whl.
File metadata
- Download URL: CryptoAesGcm-0.0.7-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/None requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5302f71a6bef377add735519ad7a9f2dec8abc9fe5fdc2af353c38ca84bd63d2
|
|
| MD5 |
5fa21e4751b65b8675ba8b76d8b31034
|
|
| BLAKE2b-256 |
8d4ac25ef41b23ddc7de62fb72190b16f2e3352f97e11bd1fe9037e590e59270
|