469,925 Members | 1,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

Python Crytographic Toolkit, AES and OpenPGP

Does anybody have an example of using Crypto.Cipher.AES to encrypt an
OpenPGP literal data packet? I can't get MODE_PGP to work at all (gpg
doesn't recognise the unencrypted packet), with MODE_CFB gpg correctly
identifies the packet after decryption but it's body is incorrect
(suggesting the first 2 bytes decrypt/encrypt ok but the rest
doesn't?). I know the plain text version of the packet is ok because I
can add it to the stream without encryption and gpg will process it ok.

Here is what I'm trying (text is the pre constructed packet):

aes_obj =
Crypto.Cipher.AES.new(self.sessionKey,Crypto.Ciphe r.AES.MODE_CFB,"\x00"*16)
padding = self.randPool.get_bytes(Crypto.Cipher.AES.block_si ze)
padding = "%s%s" % (padding,padding[-2:])
self.enc_text = aes_obj.encrypt("%s%s" % (padding,text))

I'm sure I'm missing something obvious, Any pointers gratefully


Oct 24 '06 #1
0 1041

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by PyDenis | last post: by
2 posts views Thread by simen.haugen | last post: by
44 posts views Thread by jiang.haiyun | last post: by
59 posts views Thread by Kevin Walzer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.