An open API service indexing awesome lists of open source software.

https://github.com/hsbc/encryption-helper-python

A Python CLI application for generating RSA public and private key pairs.
https://github.com/hsbc/encryption-helper-python

automation cryptography data-protection devops-tools encryption hsbc key-generation key-management open-source poetry-python public-key python python-rsa python-rsa-key-pairs-public-key-private-key rsa security

Last synced: 6 months ago
JSON representation

A Python CLI application for generating RSA public and private key pairs.

Awesome Lists containing this project

README

          


HSBC Logo

Encryption Helper Python


Encryption Helper Banner


A Python CLI application for generating RSA public and private key pairs using the cryptography library


Features
Installation
Usage
Configuration
Development
License

## Features

Encryption Helper is a robust Python package designed to simplify the process of creating RSA key pairs. It leverages the [cryptography][0] 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

## Installation

This package requires Python 3.8 or later and uses cryptography for cryptographic operations.

### Using Poetry (recommended)

Ensure you have Poetry installed, then follow these steps:

```bash
# Clone the repository
git clone https://github.com/hsbc/encryption-helper-python.git
cd encryption-helper-python

# Install dependencies (including cryptography)
poetry install
```

### Using pip

If you prefer to use pip:

```bash
# 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 .
```

## Usage

### With Poetry

To generate an RSA key pair using Poetry:

```bash
poetry run encryption-helper
```

### With standard Python

If you installed the package using pip:

```bash
# If you're using a virtual environment, make sure it's activated
encryption-helper
```

Or run the module directly:

```bash
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

## Configuration

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.

## Development

### With Poetry

To set up the development environment using Poetry:

```bash
# 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
```

### With standard Python

If you're not using Poetry:

```bash
# 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
```

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

[0]: https://github.com/pyca/cryptography