[ pycrypto-Bugs-1402843 ] RSA encryption failing.

"SourceForge.net" <[email protected]> Thu, 06 Apr 2006 01:27:59 -0700
Newsgroups gmane.comp.python.cryptography.cvs
Message-ID <[email protected]>
Bugs item #1402843, was opened at 2006-01-11 13:35
Message generated for change (Comment added) made by idsvandermolen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1402843&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
Submitted By: Eric Noyau (eric_noyau)
Assigned to: Nobody/Anonymous (nobody)
Summary: RSA encryption failing.

Initial Comment:
I'm using RSA encryption to encrypt binary data. I've
notice that sometimes the decrypted data do not match
the encrypted one.

After a lot of searching I narrowed it down to block of
data starting with '\0'. See the attached test suite.

This bug may be the same as the badly explained bug
1212602.

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

Comment By: Ids van der Molen (idsvandermolen)
Date: 2006-04-06 10:27

Message:
Logged In: YES 
user_id=1390172

The encrypt method of Crypto.PublicKey.pubkey.pubkey
converts a string to a long using
Crypto.Util.number.bytes_to_long. As a consequence all
heading 'zero' bytes within the string are
discarded/useless, i.e. 'A', '\x00A' and '\x00\x00A' all are
converted to 65L. 
pubkey.decrypt(pubkey.encrypt(65L)) will return 'A'

I think this is a serious problem, for which I haven't got a
solution (yet).

Tested with pycrypto 2.0.1

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642