Page 1 of 1

Error while in testing JavaCOS A22 dual interface Java card with RSA and encryption/signing

Posted: Mon Jul 18, 2016 1:37 am
by Hooben
One customer was test Feitian JAVA COS A22CR, the applet using JCAlgTest

The log can found from attachment.

My proprietary application gets CryptoException.ILLEGAL_USE for every call to to .doFinal for RSA ciphers. (It's working fine on a variety of other cards)

And running JCAlgTest

http://www.fi.muni.cz/~xsvenda/jcsupport.html
AlgTest_JavaCard/AlgTest_v1.6.1_jc2.2.2.cap

in performance testing mode (which actually tries to use the ciphers)

fails for every RSA operation except .update on ALG_RSA_NOPAD with 512 bit RSA key.

[relevant section of log attached]

Re: Error while in testing JavaCOS A22 dual interface Java card with RSA and encryption/signing

Posted: Mon Jul 18, 2016 2:17 am
by JavaCardOS
Just to confirm the problem, after generating keypair, call setP and setQ to do setting operation.

Code: Select all

            kp.genKeyPair();
           
            RSAPrivateCrtKey priKey = (RSAPrivateCrtKey) kp.getPrivate();   // Code added;
            short pLen = priKey.getP(buf, (short) 0);                       // Code added;
            priKey.setP(buf, (short) 0, pLen);                              // Code added;
            short qLen = priKey.getQ(buf, (short) 0);                       // Code added;
            priKey.setQ(buf, (short) 0, qLen);                              // Code added;


After modifying, do your own test again. Await for your reply!

Re: Error while in testing JavaCOS A22 dual interface Java card with RSA and encryption/signing

Posted: Mon Jul 18, 2016 2:27 am
by wousim
JFYI:

I have encountered this problem before. I found there was something wrong with RSA algo in A22CR.

Recently, I bought several A22CR cards from JavaCardOS e-shop and the cards didn't have any problem with RSA.

I guessed that the problem has been fixed.

Re: Error while in testing JavaCOS A22 dual interface Java card with RSA and encryption/signing

Posted: Sun Sep 04, 2016 11:48 pm
by Hooben
Our customer was did check the COS version, the answer from him, please have a look, thanks

A>> T=1 (4+0000) 80CA9F7F 00
A<< (0000+2) (13ms) 6A88

Not sure if this helps, but the ATR is:
3b:fc:18:00:00:81:31:80:45:90:67:46:4a:00:68:08:04:00:00:00:00:0e

Please check how can help on this, thanks

Re: Error while in testing JavaCOS A22 dual interface Java card with RSA and encryption/signing

Posted: Tue Sep 06, 2016 1:34 am
by capuccino
:?:

Re: Error while in testing JavaCOS A22 dual interface Java card with RSA and encryption/signing

Posted: Tue Sep 06, 2016 1:35 am
by Hooben
Just got answer, the java cos is old one, already ship latest java card to customer for test, thanks