跳转到主要内容

rage (Rust中的年龄)的Python绑定

项目描述

pyrage

CI PyPI version

Python绑定Rust实现age

索引

安装

您可以使用pip安装pyrage

$ python -m pip install pyrage

也提供了PEP 561风格的类型存根

$ python -m pip install pyrage-stubs

有关手动安装的说明,请参阅下面的开发说明

使用

身份生成(仅限x25519)

from pyrage import x25519

ident = x25519.Identity.generate()

# returns the public key
ident.to_public()

# returns the private key
str(ident)

基于身份的加密和解密

from pyrage import encrypt, decrypt, ssh, x25519

# load some identities
alice = x25519.Identity.from_str("AGE-SECRET-KEY-...")
bob = ssh.Identity.from_buffer(b"---BEGIN OPENSSH PRIVATE KEY----...")

# load some recipients
carol = x25519.Recipient.from_str("age1z...")
dave = ssh.Recipient.from_str("ssh-ed25519 ...")

# encryption
encrypted = encrypt(b"bob can't be trusted", [carol, dave, alice.to_public()])

# decryption
decrypted = decrypt(encrypted, [alice, bob])

密码加密和解密

from pyrage import passphrase

encrypted = passphrase.encrypt(b"something secret", "my extremely secure password")
decrypted = passphrase.decrypt(encrypted, "my extremely secure password")

开发

$ source env/bin/activate
$ make develop

许可

pyrage是根据MIT许可证发布和分发的。

项目详情


下载文件

下载适合您平台的文件。如果您不确定该选择哪个,请了解更多关于安装包的信息。

源分布

pyrage-1.2.1.tar.gz (28.7 kB 查看哈希值)

上传时间

构建分布

pyrage-1.2.1-cp38-abi3-win_amd64.whl (710.5 kB 查看哈希值)

上传时间 CPython 3.8+ Windows x86-64

pyrage-1.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (916.9 kB 查看哈希值)

上传时间 CPython 3.8+ manylinux: glibc 2.17+ x86-64

pyrage-1.2.1-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.6 MB 查看哈希值)

上传时间 CPython 3.8+ macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面