Hi everybody,

I have the following problem: I am using GemXpresso 211 PK/IS to develop a
javacard based solution. One part of this solution is to authenticate the
user to an external host via Challenge/Response. I would like to encrypt the
incoming challenge with my private key (RSA 512 bit) contained in my card.
My Gemplus 211PK/Is card seems to support just one RSA-Cipher algorithm:
ALG_RSA_NOPAD. When I try to use the others I get a NoSuchAlgorithm
Exception. 


Ok, so I tried the ALG_RSA_NOPAD together with my private key and what I get
is an Illegal Value Exception which is to be interpreted as an inconsistency
of the key with the Cipher-algorithm. Here is the code:

    keyP = new KeyPair(KeyPair.ALG_RSA,(short)512);
    keyP.genKeyPair();
    rsaCipher = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false);
    Key privateKey = keyP.getPrivate();
    if(!privateKey.isInitialized())
      ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);
    rsaCipher.init(privateKey, Cipher.MODE_ENCRYPT);

How can I solve this problem? Where is the bug?

thanks a lot for your help

Marcel


---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
!                           [EMAIL PROTECTED]
! containing the word
!                           unsubscribe 
! in the body.

Reply via email to