跳转到主要内容

Asherah信封加密和密钥轮换库

项目描述

asherah-python

Asherah信封加密和密钥轮换库

这是使用Cobhan FFI库包装Asherah Go实现的封装器

用法

示例代码

from asherah import Asherah, AsherahConfig

config = AsherahConfig(
    kms='static',
    metastore='memory',
    service_name='TestService',
    product_id='TestProduct',
    verbose=True,
    enable_session_caching=True
)
crypt = Asherah()
crypt.setup(config)

data = b"mysecretdata"

encrypted = crypt.encrypt("partition", data)
print(encrypted)

decrypted = crypt.decrypt("partition", encrypted)
print(decrypted)

基准测试

包含一个benchmark.py脚本,它将向您展示您可以从该库中看到的性能。我们的目标是使其尽可能高效,如下例输出所示

> python benchmark.py
Benchmarking encrypt/decrypt round trips of "mysecretdata".
Executed 100 iterations in 0.026045440000000003 seconds.
Executed 1000 iterations in 0.237702095 seconds.
Executed 10000 iterations in 2.3570790550000003 seconds.
Executed 100000 iterations in 23.717442475 seconds.

项目详情


下载文件

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

源分布

asherah-0.3.9.tar.gz (15.3 MB 查看哈希值)

上传时间

构建分布

asherah-0.3.9-py3-none-any.whl (15.4 MB 查看哈希值)

上传时间 Python 3

由...