I want to encrypt few files using python what is the best way i can use gpg but are there any standarad/famous python libraries?
Why do yo say that?
Esteban Araya
2008-09-18 06:05:45
It's comprehensive and the original author AMK is a respected Python developer.
Swaroop C H
2008-09-18 06:06:45
Yes, but its current maintainer does not have any releases out (as checked today)
Daren Thomas
2008-10-05 19:15:43
Pycrypto is quite incomplete. It lacks for example the padding schemes for asymmetric encryption schemes. Implementing them yourself is tricky and easily leads to insecure results. Much better is to use one of those libaries that are wrappers around well tested libs like openssl, pgp or gpg.
Accipitridae
2009-10-09 08:26:50
+4
A:
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
bortzmeyer
2008-09-18 08:30:53
A:
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.
gooli
2008-09-18 11:12:45