A Python CLI application for generating RSA public and private key pairs using the cryptography library
Features • Installation • Usage • Configuration • Development • License
Encryption Helper is a robust Python package designed to simplify the process of creating RSA key pairs. It leverages the cryptography library to offer:
- Generation of 2048-bit RSA key pairs
- Automatic saving of keys in PEM format
- Logging of key generation for debugging purposes
- Simple CLI interface for ease of use
This package requires Python 3.8 or later and uses cryptography for cryptographic operations.
Ensure you have Poetry installed, then follow these steps:
# Clone the repository
git clone https://github.com/hsbc/encryption-helper-python.git
cd encryption-helper-python
# Install dependencies (including cryptography)
poetry install
If you prefer to use pip:
# Clone the repository
git clone https://github.com/hsbc/encryption-helper-python.git
cd encryption-helper-python
# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
# Install the package and its dependencies (including cryptography)
pip install .
To generate an RSA key pair using Poetry:
poetry run encryption-helper
If you installed the package using pip:
# If you're using a virtual environment, make sure it's activated
encryption-helper
Or run the module directly:
python -m encryption_helper
These commands will:
- Use cryptography to generate a 2048-bit RSA key pair
- Save the private key to
keys/pem/private-key.pem
- Save the public key to
keys/pem/public-key.pem
- Display both keys in the console
- Log the key generation process
The key generation process uses cryptography with the following specifications:
- Standard: PKCS#1
- Type: RSA
- Size: 2048 bits
To modify these settings, you'll need to edit the generate_rsa_key()
function in encryption_helper/main.py
. Refer to the cryptography documentation for more advanced configurations.
To set up the development environment using Poetry:
# Create a virtual environment and install dependencies
poetry install
# Activate the virtual environment
poetry shell
# Run tests
pytest tests/
# Generate documentation
pydoc -w encryption_helper
If you're not using Poetry:
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
# Install development dependencies
pip install .[dev]
# Run tests
pytest tests/
# Generate documentation
pydoc -w encryption_helper
This project is licensed under the MIT License. See the LICENSE file for details.