12 个版本
0.4.1 | 2022 年 5 月 2 日 |
---|---|
0.4.0 | 2022 年 3 月 14 日 |
0.3.1 | 2021 年 7 月 5 日 |
0.2.1 | 2021 年 6 月 9 日 |
0.1.2 | 2020 年 11 月 19 日 |
#555 in 密码学
每月 51 次下载
在 crypt4ghfs 中使用
1.5MB
2K SLoC
包含 (WOFF 字体, 99KB) fontawesome-webfont.woff, (WOFF 字体, 78KB) fontawesome-webfont.woff2, (WOFF 字体, 45KB) open-sans-v17-all-charsets-300.woff2, (WOFF 字体, 41KB) open-sans-v17-all-charsets-300italic.woff2, (WOFF 字体, 45KB) open-sans-v17-all-charsets-600.woff2, (WOFF 字体, 43KB) open-sans-v17-all-charsets-600italic.woff2 以及 7 个其他文件.
crypt4gh-rust
Crypt4GH 加密格式的 Rust 实现。
命令行界面
安装
从源代码安装
要求:Rust
cargo install crypt4gh
二进制文件
在 发布页面,您可以找到以下编译的二进制文件:
用法
Utility for the cryptographic GA4GH standard, reading from stdin and outputting to stdout.
USAGE:
crypt4gh [FLAGS] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-v, --verbose Sets the level of verbosity
-V, --version Prints version information
SUBCOMMANDS:
decrypt Decrypts the input using your secret key and the (optional) public key of the sender.
encrypt Encrypts the input using your (optional) secret key and the public key of the recipient.
help Prints this message or the help of the given subcommand(s)
keygen Utility to create Crypt4GH-formatted keys.
rearrange Rearranges the input according to the edit list packet.
reencrypt Decrypts the input using your (optional) secret key and then it reencrypts it using the
public key of the recipient.
示例
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
库
库安装
将以下内容添加到您的 Cargo.toml
[dependencies]
crypt4gh = "0.4.0"
Rust 中的用法
使用暴露的函数
pub fn encrypt<R: Read, W: Write>(
recipient_keys: &HashSet<Keys>,
read_buffer: &mut R,
write_buffer: &mut W,
range_start: usize,
range_span: Option<usize>
) -> Result<()>
pub fn decrypt<R: Read, W: Write>(
keys: Vec<Keys>,
read_buffer: &mut R,
write_buffer: &mut W,
range_start: usize,
range_span: Option<usize>,
sender_pubkey: Option<Vec<u8>>,
) -> Result<()>
pub fn reencrypt<R: Read, W: Write>(
keys: Vec<Keys>,
recipient_keys: HashSet<Keys>,
read_buffer: &mut R,
write_buffer: &mut W,
trim: bool,
) -> Result<()>
pub fn rearrange<R: Read, W: Write>(
keys: Vec<Keys>,
read_buffer: &mut R,
write_buffer: &mut W,
range_start: usize,
range_span: Option<usize>,
) -> Result<()>
文档
要了解更多关于 Crypt4GH 的信息,请参阅 官方文档。
故障排除
在 Windows 上从源代码构建之前,您应该首先安装 MSVC 构建工具。
依赖项
~25–35MB
~294K SLoC