472,353 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Python Crytographic Toolkit, AES and OpenPGP

Hello,
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
recieved.

Thanks.
M.

Oct 24 '06 #1
0 1088

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Irmen de Jong | last post by:
QOTW: "Confronting the Martellibot is like flirting with an encyclopedia, I'd rather not do it myself, but I respect those who do, because it...
0
by: Irmen de Jong | last post by:
QOTW: "I'll claim without proof that how mixed-type comparisons work with Python classes is also beyond wizard prediction in all cases: the...
16
by: PyDenis | last post by:
Today, I found strange error while using py2exe: 1. I wrote simple program and save as 1.py: import win32ui import win32con ...
2
by: simen.haugen | last post by:
Hi. I'm trying to use Python 2.4 with MySql 5.0, but I'm having installation problems. I've tried to follow the following articles to install...
48
by: meyer | last post by:
Hi everyone, which compiler will Python 2.5 on Windows (Intel) be built with? I notice that Python 2.4 apparently has been built with the VS2003...
44
by: jiang.haiyun | last post by:
Now i began to learn GUI programming. There are so many choices of GUI in the python world, wxPython, pyGTK, PyQT, Tkinter, .etc, it's difficult...
59
by: Kevin Walzer | last post by:
From the introduction to PyObjC, the Python-Objective-C bridge on Mac OS X: "As described in Objective-C for PyObjC users the creation of...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.