Skip to main content

A simple Python encryption library

Project description

Cryptum

Build Status codecov Test and Publish Cryptum

Overview

Cryptum is a simple Python encryption library that generates RSA public/private keys and encrypts data for easy transport between applications and languages. It provides a straightforward CLI interface for key management and file encryption/decryption.

Features

  • Generate RSA public/private key pairs
  • Encrypt files using public keys
  • Decrypt files using private keys
  • Command-line interface for easy use

Installation

Install Cryptum using pip:

pip install cryptum

Usage

Command-line Interface

Cryptum provides a command-line interface cryptcli.py for easy use.

Help

cryptcli.py --help

Output:

Usage: cryptcli.py [OPTIONS]

Options:
  -e, --encrypt              Encrypt input file.
  -f, --input_file FILENAME  The Input File.
  -k, --input_key FILENAME   The Public/Private Key to use.
  -d, --decrypt              Decrypt input file.
  -o, --output TEXT          Output file.
  -g, --generate             Generate Encryption Keys.
  --version
  --help                     Show this message and exit.

Generate New Private/Public Keys

cryptcli.py -g

Encrypt a File

cryptcli.py -e -f test.txt -k pub.txt

This command encrypts test.txt using the public key in pub.txt.

Decrypt a File

cryptcli.py -d -f test.txt.enc -k priv.txt

This command decrypts test.txt.enc using the private key in priv.txt.

Python API

You can also use Cryptum as a Python library in your projects. Here's a basic example:

from cryptum import generate_keys, encrypt_file, decrypt_file

# Generate keys
public_key, private_key = generate_keys()

# Encrypt a file
encrypt_file('input.txt', 'input.txt.enc', public_key)

# Decrypt a file
decrypt_file('input.txt.enc', 'output.txt', private_key)

Development

To set up the development environment:

  1. Clone the repository
  2. Install development dependencies:
    pip install -r requirements-dev.txt
    
  3. Run tests:
    pytest
    

Continuous Integration and Deployment

This project uses GitHub Actions for continuous integration and deployment. The workflow does the following:

  1. Runs tests on multiple Python versions (3.7, 3.8, 3.9, 3.10)
  2. Lints the code using flake8
  3. Builds the package
  4. Publishes the package to PyPI on pushes to the main branch

You can view the detailed workflow in the .github/workflows/test-and-publish.yml file.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

[0.0.3] - 2024-08-15

  • Added Python API documentation
  • Added proper test suite with pytest
  • Improved error handling in CLI

[0.0.1] - 2020-02-02

  • Initial release

Contact

For questions and support, please open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cryptum-0.0.3.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

cryptum-0.0.3-py2.py3-none-any.whl (13.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page