Cryptography tool based on RSA and AES
Project description
NyxCrypta
NyxCrypta is a Python cryptography library that combines asymmetric RSA encryption and symmetric AES encryption to secure your data efficiently and easily.
Features
- 🔐 RSA key pair generation with multiple security levels
- 📄 Multiple key formats support (PEM, DER, SSH)
- 🔒 File encryption and decryption
- 💾 Raw data encryption and decryption
- 🛡️ Strong encryption using RSA + AES hybrid approach
- 🔄 Key format conversion utilities
Security Levels
- Standard (2048-bit RSA)
- High (3072-bit RSA)
- Paranoid (4096-bit RSA)
Installation
From PyPI:
pip install nyxcrypta
From source:
git clone https://github.com/Division-of-Cyber-Anarchy/NyxCrypta.git
cd NyxCrypta
pip install -e .
Usage
Key Generation
Generate a key pair in PEM format:
nyxcrypta keygen -o ./keys -p "your_strong_password" -f PEM
Generate a key pair in DER format:
nyxcrypta keygen -o ./keys -p "your_strong_password" -f DER
Generate a public key in SSH format:
nyxcrypta keygen -o ./keys -p "your_strong_password" -f SSH
Key Format Conversion
Convert from PEM to DER:
nyxcrypta convert -i ./keys/public_key.pem -o ./keys/key.der --from-format PEM --to-format DER
Convert from DER to SSH (public key only):
nyxcrypta convert -i ./keys/public_key.der -o ./keys/key.ssh --from-format DER --to-format SSH --public
File Encryption/Decryption
Encrypt a file:
nyxcrypta encrypt -i file.txt -o file.nyx -k ./keys/public_key.pem
Decrypt a file:
nyxcrypta decrypt -i file.nyx -o file.txt -k ./keys/private_key.pem -p "your_password"
Data Encryption/Decryption
Encrypt raw data:
nyxcrypta encryptdata -d "My secret data" -k ./keys/public_key.pem
Decrypt raw data:
nyxcrypta decryptdata -d "encrypted_hex_string" -k ./keys/private_key.pem -p "your_password"
Security Features
- Hybrid encryption using RSA for key exchange and AES for data encryption
- Strong key derivation using Argon2
- Secure random number generation
- Support for multiple security levels
- Encrypted private key storage
Testing
Run the test suite:
nyxcrypta test
Key Format Support
Public Keys
- PEM format (.pem)
- DER format (.der)
- OpenSSH format (.ssh)
- JSON format (.json)
Private Keys
- PEM format (.pem)
- DER format (.der)
- JSON format (.json)
Python example
from nyxcrypta import NyxCrypta, SecurityLevel, KeyFormat
# Initialize NyxCrypta
nx = NyxCrypta() # Uses STANDARD security level by default
# Generate key pair
nx.save_keys("./keys", "your_password", KeyFormat.PEM)
# Encrypt a file
nx.encrypt_file("secret.txt", "secret.nyx", "./keys/public_key.pem")
# Decrypt a file
nx.decrypt_file("secret.nyx", "decrypted.txt", "./keys/private_key.pem", "your_password")
# Encrypt and decrypt data
message = b"Hello, World!"
encrypted = nx.encrypt_data(message, "./keys/public_key.pem")
decrypted = nx.decrypt_data(bytes.fromhex(encrypted), "./keys/private_key.pem", "your_password")
print(decrypted.decode()) # Prints: Hello, World!
# Using higher security level
nx_secure = NyxCrypta(SecurityLevel.PARANOID)
nx_secure.save_keys("./secure_keys", "your_password", KeyFormat.PEM)
# Key format conversion
from nyxcrypta import KeyConverter
# Convert public key from PEM to SSH format
with open("./keys/public_key.pem", "rb") as f:
pem_data = f.read()
ssh_key = KeyConverter.convert_public_key(pem_data, KeyFormat.PEM, KeyFormat.SSH)
with open("./keys/public_key.ssh", "wb") as f:
f.write(ssh_key)
# Convert private key from PEM to DER format
with open("./keys/private_key.pem", "rb") as f:
pem_data = f.read()
der_key = KeyConverter.convert_private_key(
pem_data,
KeyFormat.PEM,
KeyFormat.DER,
"your_password".encode()
)
with open("./keys/private_key.der", "wb") as f:
f.write(der_key)
Dependencies
- cryptography>=41.0.5
- argon2-cffi>=20.1.0
- cffi>=1.0.0
- tqdm>=4.67
Security Considerations
- Always use strong passwords for private keys
- Keep private keys secure and never share them
- Use appropriate security levels based on your needs
- Regularly update encryption keys
- Verify file integrity after encryption/decryption
Development Status
This project is currently in active development. While it's functional, please be aware that:
- The API may change without notice
- Some features might be experimental
- Additional testing and security audits are ongoing
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Bug Reports and Feature Requests
Please use the GitHub issue tracker to report bugs or suggest features.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
Division of Cyber Anarchy (DCA)
Contact : malic1tus@proton.me nyxcrypta@proton.me calypt0sis@proton.me viral0x@proton.me
Github : https://github.com/Division-of-Cyber-Anarchy/
Simplicity is the ultimate sophistication. - Leonardo da Vinci
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 nyxcrypta-1.4.0.tar.gz.
File metadata
- Download URL: nyxcrypta-1.4.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
350573764f596ce7ebe8bf16f889ca08b52f493e0029b8c7af8ea2c9984be6f6
|
|
| MD5 |
9837a5160b5c37ce709867a0676d5d5e
|
|
| BLAKE2b-256 |
3f1eec5945fd75db830971ebd3d233a23cb5edd02c33ef9f6c3acdc50e42959d
|
File details
Details for the file nyxcrypta-1.4.0-py3-none-any.whl.
File metadata
- Download URL: nyxcrypta-1.4.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd40b4fc789836d748233b54916c13e912245794d3d8de6a2ebc6ee902b8c134
|
|
| MD5 |
abb426d0c21e19f519eb41854080319a
|
|
| BLAKE2b-256 |
61b9d5bb59a9b820fd9bbfe42ad1b589aee8200aefb1d4939ddd2cd82c9316f4
|