[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] encrypt with RSA twice



Hello to all,

When I try to ENCRYPT  the same data twice using two keys RSA...

Example:

    -- keyPR and keyPu are a key par, and key2PR and key2Pu  are another

key par

     RSACipher.init(Cipher.ENCRYPT_MODE,keyPR);

     byte a[] =  desCipher.doFinal("hello to all".getBytes());

     RSACipher2.init(Cipher.ENCRYPT_MODE,key2PU);

    byte c[] =  desCipher.doFinal(a); *

On second *  iteration appears this error::
    javax.crypto.BadPaddingException: Padding String must be at least 8
octets long!
        at iaik.pkcs.pkcs1.RSACipher.b(Unknown Source)
        at iaik.pkcs.pkcs1.RSACipher.engineDoFinal(Unknown Source)
        at javax.crypto.Cipher.doFinal(Unknown Source)


Why isn't  ENCRYPT the same data twice?

Obrigado,
Pedro

--
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce