RSA cryptography between Python and Java

M.-A. Lemburg mal at
Tue Jul 28 09:30:23 CEST 2009

Rob Knop wrote:
> I've created an RSA key in Java.  I have exported the public key by
> making it into a X509EncodedKeySpec and spitting out the result of
> getEncoded().
> I want to use this public key to encode something in python that I will
> send to Java, and then decode in Java with the corresponding private
> key.
> Are there any python libraries that will take a public key in this
> format and do RSA encoding on it?

M2Crypto will let you do this:

If you have access to the raw key data (instead of having it
encoded in a X509 certificate), then you can also use PyCrypto,
which does require setting up OpenSSL first:

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Jul 28 2009)
>>> Python/Zope Consulting and Support ...
>>> mxODBC.Zope.Database.Adapter ...   
>>> mxODBC, mxDateTime, mxTextTools ...

::: Try our new mxODBC.Connect Python Database Interface for free ! :::: Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-list mailing list