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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/90413/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 19:29:11  来源:igfitidea点击:

what is the best/easiest to use encryption library in python

pythonencryptiongnupgpgp

提问by Anurag Uniyal

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

我想使用 python 加密几个文件,我可以使用任何标准/著名的 python 库使用 gpg/pgp 的最佳方法是什么?

采纳答案by Swaroop C H

PyCryptoseems to be the best one around.

PyCrypto似乎是最好的。

回答by Swaroop C H

Try KeyCzar

试试KeyCzar

Very easy to implement.

非常容易实施。

回答by bortzmeyer

I use GPGmeThe 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.

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

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

它有一个Python 接口。警告:它是一个低级接口,不是很 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

回答by HughE

I use pyOpenSSL, its a python binding for OpenSSLwhich 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.

我使用pyOpenSSL,它是OpenSSL的 python 绑定,它已经存在很长时间并且经过很好的测试。我为我的应用程序做了一些基准测试,这是非常加密的,并且它战胜了 pyCrypto。天啊。

回答by Allen

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

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

回答by elifiner

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.

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