GA4GH cryptographic utilities
Project description
Crypt4GH Encryption Utility
crypt4gh
is a Python tool to encrypt, decrypt or re-encrypt files, according to the GA4GH encryption file format.
Installation
Python 3.6+
required to use the crypt4gh encryption utility.
Install it from PyPI:
pip install crypt4gh
or if you prefer the latest sources from Github:
git clone https://github.com/EGA-archive/crypt4gh
pip install -r crypt4gh/requirements.txt
pip install ./crypt4gh
or
pip install git+https://github.com/EGA-archive/crypt4gh.git
Usage
The usual -h
flag shows you the different options that the tool accepts.
$ crypt4gh -h
Utility for the cryptographic GA4GH standard, reading from stdin and outputting to stdout.
Usage:
{PROG} [-hv] [--log <file>] encrypt [--sk <path>] --recipient_pk <path> [--recipient_pk <path>]... [--range <start-end>] [--header <path>]
{PROG} [-hv] [--log <file>] decrypt [--sk <path>] [--sender_pk <path>] [--range <start-end>]
{PROG} [-hv] [--log <file>] rearrange [--sk <path>] --range <start-end>
{PROG} [-hv] [--log <file>] reencrypt [--sk <path>] --recipient_pk <path> [--recipient_pk <path>]... [--trim] [--header-only]
Options:
-h, --help Prints this help and exit
-v, --version Prints the version and exits
--log <file> Path to the logger file (in YML format)
--sk <keyfile> Curve25519-based Private key.
When encrypting, if neither the private key nor C4GH_SECRET_KEY are specified, we generate a new key
--recipient_pk <path> Recipient's Curve25519-based Public key
--sender_pk <path> Peer's Curve25519-based Public key to verify provenance (akin to signature)
--range <start-end> Byte-range either as <start-end> or just <start> (Start included, End excluded)
-t, --trim Keep only header packets that you can decrypt
--header <path> Where to write the header (default: stdout)
--header-only Whether the input data consists only of a header (default: false)
Environment variables:
C4GH_LOG If defined, it will be used as the default logger
C4GH_SECRET_KEY If defined, it will be used as the default secret key (ie --sk ${C4GH_SECRET_KEY})
Demonstration
Alice and Bob generate both a pair of public/private keys.
$ crypt4gh-keygen --sk alice.sec --pk alice.pub
$ crypt4gh-keygen --sk bob.sec --pk bob.pub
Bob encrypts a file for Alice:
$ crypt4gh encrypt --sk bob.sec --recipient_pk alice.pub < file > file.c4gh
Alice decrypts the encrypted file:
$ crypt4gh decrypt --sk alice.sec < file.c4gh
File Format
Refer to the specifications or this documentation.
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
crypt4gh-1.7.tar.gz
(27.0 kB
view details)
Built Distribution
crypt4gh-1.7-py3-none-any.whl
(32.3 kB
view details)
File details
Details for the file crypt4gh-1.7.tar.gz
.
File metadata
- Download URL: crypt4gh-1.7.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1569bc4ff9b689c8852e3892ac3f6fea4b31948ca0b1e5bc28d0d2f80def2a28 |
|
MD5 | 3893e95a90bea30fa5f24bd7e376c165 |
|
BLAKE2b-256 | 0d17f91f2bc504a3b4bd95087b18498f1820b88aef04f830afa13107129a1782 |
File details
Details for the file crypt4gh-1.7-py3-none-any.whl
.
File metadata
- Download URL: crypt4gh-1.7-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aeb37065769a560b5bbe8cf67c47eb4d8b53ed36725a8d3fb0385084c682c3c |
|
MD5 | 714d6dd6908e5c16f8cde42d6e433f98 |
|
BLAKE2b-256 | 35136be4ee55292b845c9ed41c666b3941cfaa5b85a6eeb682d5aad7a3b5b691 |