[ pycrypto-Bugs-1212602 ] Wrong RSA encryption

"SourceForge.net" <[email protected]> Fri, 08 Jun 2007 02:06:51 -0700
Newsgroups gmane.comp.python.cryptography.cvs
Message-ID <[email protected]>
Bugs item #1212602, was opened at 2005-06-01 02:59
Message generated for change (Comment added) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1212602&group_id=20937

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wrong RSA encryption

Initial Comment:
A big file is split up in chunks smaller than
((size()+1)/8 - 11).
The modules contains 64 bytes so a chunk is 53 bytes.
In front I add 0x00 0x02 PS 0x00 (the PKCS1 standard?).
PS is pseudo non zero random padding of at least 8 bytes.
Sometimes (seems irregular) encrypt() returns 63 bytes.
64 bytes are expected. 
Then I call encrypt() again for the same data. 
This second time the correct 64 bytes are returned.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2007-06-08 02:06

Message:
Logged In: NO 

Test script to prove problem above:

from Crypto.PublicKey import RSA
from Crypt.Util import randpool
import binascii

r = randpool.RandomPool()
k = RSA.generate(1024, r.get_bytes)

pt = "0002010101010101010100" + ''.join(["FF"] * 117)
print len(pt)

ct = k.encrypt(binascii.unheclify(pt), r.get_bytes(100))
ptnew = k.decrypt(ct[0])
print len(ptnew)



----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2005-06-10 12:38

Message:
Logged In: YES 
user_id=11375

Please provide a small test script that demonstrates the
problem.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1212602&group_id=20937

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/