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

自闭症网瘾萝莉.ら 提交于 2019-12-04 15:51:19

问题


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


回答1:


PyCrypto seems to be the best one around.




回答2:


Try KeyCzar

Very easy to implement.




回答3:


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



回答4:


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.




回答5:


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




回答6:


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.



来源:https://stackoverflow.com/questions/90413/what-is-the-best-easiest-to-use-encryption-library-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!