python中最好/最容易使用的加密库是什么

发布于 2024-07-06 02:03:36 字数 72 浏览 6 评论 0原文

我想使用 python 加密一些文件,最好的方法是什么 我可以使用任何标准/著名的 python 库来使用 gpg/pgp 吗?

I want to encrypt few files using python what is the best way
I can use gpg/pgp using any standard/famous python libraries?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

素手挽清风 2024-07-13 02:03:36

PyCrypto 似乎是最好的。

PyCrypto seems to be the best one around.

萌梦深 2024-07-13 02:03:36

尝试 KeyCzar

非常容易实现。

Try KeyCzar

Very easy to implement.

我喜欢麦丽素 2024-07-13 02:03:36

我使用 GPGme GPGme 的主要优点是它可以读取和写入文件符合 OpenPGP 标准 (RFC 4880),如果您想与其他设备进行互操作,这可能很重要PGP 程序。

它有一个 Python 接口。 警告:它是一个低级接口,不是很Pythonic。

如果您阅读法语,请查看示例

这是一个检查签名的方法:

signed = core.Data(sys.stdin.read())
plain = core.Data()
context = core.Context()

context.op_verify(signed, None, plain)
result = context.op_verify_result()

sign = result.signatures
while sign:
    if sign.status != 0:
        print "BAD signature from:"
    else:
        print "Good signature from:"
    print "  uid:        ", context.get_key(sign.fpr, 0).uids.uid
    print "  timestamp:  ", sign.timestamp
    print "  fingerprint:", sign.fpr
    sign = sign.next

I use GPGme The main strength of GPGme is that it read and writes files at the OpenPGP standard (RFC 4880) which can be important if you want to interoperate with other PGP programs.

It has a Python interface. Warning: it is a low-level interface, not very Pythonic.

If you read French, see examples.

Here is one, to check a signature:

signed = core.Data(sys.stdin.read())
plain = core.Data()
context = core.Context()

context.op_verify(signed, None, plain)
result = context.op_verify_result()

sign = result.signatures
while sign:
    if sign.status != 0:
        print "BAD signature from:"
    else:
        print "Good signature from:"
    print "  uid:        ", context.get_key(sign.fpr, 0).uids.uid
    print "  timestamp:  ", sign.timestamp
    print "  fingerprint:", sign.fpr
    sign = sign.next
稀香 2024-07-13 02:03:36

我使用 pyOpenSSL,它是 OpenSSL 已经存在很长时间并且经过了很好的测试。 我为我的应用程序做了一些基准测试,该应用程序是加密密集型的,并且它轻松击败了 pyCrypto。 YMMV。

I use pyOpenSSL, its a python binding for OpenSSL which has been around for a long time and is very well tested. I did some benchmarks for my application, which is very crypto intensive and it won hands down against pyCrypto. YMMV.

北音执念 2024-07-13 02:03:36

请参阅 Google 的 Keyczar 项目,该项目为 PyCrypto 功能提供了一组很好的接口。

See Google's Keyczar project, which provides a nice set of interfaces to PyCrypto's functionality.

流心雨 2024-07-13 02:03:36

我喜欢 pyDes (http://twhiteman.netfirms.com/des.html)。 它不是最快的,但它是纯Python,并且非常适合少量的加密数据。

I like pyDes (http://twhiteman.netfirms.com/des.html). It's not the quickest, but it's pure Python and works very well for small amounts of encrypted data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文