GA4GH加密实用程序
crypt4gh的Python项目详细描述
Crypt4GH加密实用程序
crypt4gh
是一个Python工具,用于加密、解密或重新加密文件,根据GA4GH encryption file format。在
安装
Python 3.6+
需要使用crypt4gh加密实用程序。在
从PyPI安装:
pip install crypt4gh
或者,如果您更喜欢来自Github的最新来源:
^{pr2}$或者
pip install git+https://github.com/EGA-archive/crypt4gh.git
使用
通常的-h
标志向您显示工具接受的不同选项。在
$ 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>]{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] 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 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})
示范
Alice和Bob都生成一对公钥/私钥。在
$ crypt4gh-keygen --sk alice.sec --pk alice.pub $ crypt4gh-keygen --sk bob.sec --pk bob.pub
Bob为Alice加密文件:
$ crypt4gh encrypt --sk bob.sec --recipient_pk alice.pub < file > file.c4gh
Alice解密加密文件:
$ crypt4gh decrypt --sk alice.sec < file.c4gh
文件格式
参考specifications或这个documentation。在
- 项目
标签: