[pycrypto] RSA importKey

Legrandin gooksankoo at hoiptorrow.mailexpire.com
Sun Nov 14 17:04:37 CST 2010


Hi Francois,

importKey was included in pycrypto 2.2. Try to print Crypto.__version__
to see which library your interpreter is picking up (most likely an
older one).

RSA in pycrypto currently uses no padding: it directly carries out the
exponentiation. Last year I created a patch to pycrypto 2.1 to support PKCS#1 v1.5
padding. You can find it here https://bugs.launchpad.net/pycrypto/+bug/502291 .
BTW, PKCS#5 is not applicable to RSA.

Legrandin

>    I have another Question concernant PyCrypto's implementation of RSA: which
>    encryption mode is it using? 
>    I had to use PyCrypto's implementation of DES recently, and I could easily
>    choose between several modes (MODE_EBC, MODE_CBC,...), but unfortunatly, I
>    can't find these modes in RSA.
>    The same question applied for the Padding options. Can I choose between
>    PKCS5Padding and PKCS1Padding ?
>    Thanks !
> 
>    2010/11/12 Franc,ois Santy <francoissanty at gmail.com>
> 
>      Hi everybody !
>      I'm currently working with pycrypto and I want to import public and
>      private keys from DER files.
>      I found a piece of code that shows how to proceed, but it isn't working
>      anyway !
>      Here is the code I'm using:
> 
>        f = file("./public_key.der")
>        key = RSA.importKey(f.read())
> 
>      It tells me 'module' object has no attribute 'importKey'. It's rather
>      strange since the method appears explicitely in the file
>      /lib/Crypto/PublicKey/RSA.py.
>      What am I doing wrong ?
>      Thanks.
>      --
>      Franc,ois S.
> 
>    --
>    Franc,ois S.

> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto



More information about the pycrypto mailing list