crypt-utilities-0.0.7
توضیحات
An easy and simplified cryptographic utility package (fernet, RSA, hashes...)
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | crypt-utilities-0.0.7 |
| نام | crypt-utilities |
| نسخه کتابخانه | 0.0.7 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Pablo García Mesa |
| ایمیل نویسنده | pgmesa.sm@gmail.com |
| آدرس صفحه اصلی | https://github.com/pgmesa-packages/crypt_utilities |
| آدرس اینترنتی | https://pypi.org/project/crypt-utilities/ |
| مجوز | - |
# Cryptographic utility package
An easy and simplified cryptographic utility package (fernet, RSA, hashes...) with some
common encryption stuff already programmed (very simple and with common secure parameters by default).
It uses the 'cryptography' module
### Installation
```
pip install crypt-utilities
```
### Modules
#### Symmetric
```
def encrypt ...
def encrypt_file ...
def decrypt_file ...
```
#### Hashes
```
def derive(data:bytes, salt:bytes, length:int=32, iterations=400000) -> bytes:...
```
#### Asymmetric
```
def rsa_encrypt (...
def generate_rsa_key_pairs (...
def generate_private_key (...
def serialize_pem_public_key (...
def load_pem_private_key (...
```
### Usage Example
```
# Encrypt with RSA (asymmetric)
# -- John
secret_msg = "Very secret msg to send"
public_key = load_pem_public_key(file_path="./public_key")
encrypted:bytes = rsa_encrypt(secret_msg.encode(), public_key)
...
# Decrypt with RSA (asymmetric)
# -- Michael
private_key_path = str(input(" -> Introduce your private key file path: "))
password = str(input(" -> Introduce the private key password (blank if None was used): "))
if password == "":
password = None
try:
private_key = load_pem_private_key(file_path=private_key_path, password=password)
except :
print("[!] Wrong Password"); exit(1)
secret_msg_sent_by_john = rsa_decrypt(encrypted, private_key).decode()
```
نیازمندی
| مقدار | نام |
|---|---|
| ==1.15.0 | cffi |
| ==36.0.1 | cryptography |
| ==2.21 | pycparser |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl crypt-utilities-0.0.7:
pip install crypt-utilities-0.0.7.whl
نصب پکیج tar.gz crypt-utilities-0.0.7:
pip install crypt-utilities-0.0.7.tar.gz