[pycrypto] RSA output on long inputs can sometimes be gibberish

Philip Horger campadrenalin at gmail.com
Thu Jul 26 18:05:56 EDT 2012

I'm working on a project that includes a wrapper for cryptographic
encoding, which lets you express an "encryptor" as a JSON list. Of
course, this kinda hinges on the underlying cryptography code working,
and since I'm the sort of person who likes cryptographic privacy but
doesn't have an expert grasp on it, I make good use of my PyCrypto

However, I *am* having issues regarding the RSA encryptor which delve
beyond my ken, and which may or may not indicate problems with the
underlying PyCrypto implementation. I wrote some test code and created
a bug report in my project:


The test involves the reversibility of the RSA process, using the
decrypt function on raw input as a bit of a hack to encrypt with the
private key (such that the public key can be used to decrypt it). This
matches the real-world functionality it will be used for, where data
at the innermost layer of encryption will be encrypted with the
sender's private key. This may seem silly, but it both acts as an
obfuscation and saves bandwidth (by accomplishing the intention of a
signature without the network overhead).

If sending raw data through the decrypt function is the problem, as I
suspect, then I can change the EJTP protocol to use proper signatures,
that's no biggy. But if this reveals problems in PyCrypto... I figured
you guys would want to know.

Anyways, my social anxiety and procrastination have delayed me from
this for long enough. Thank you for your time, and for PyCrypto being

More information about the pycrypto mailing list