Page 1 of 1

JavaCard Algorithms Support Test Tool

Posted: Wed Jul 01, 2015 6:03 am
by Ellisun
What it does?
1, Provides list of supported algorithms from JavaCard API including supported lengths of keys.
2, Provides basic speed tests for selected operations

The basic idea is simple - if the particular algorithm/key size is supported, then instance creation will succeed. Otherwise, CryptoException.NO_SUCH_ALGORITHM is thrown. This can be employed for fast test of supported algorithms. AlgTest applet tries to create instance of algorithms for all possible constants defined in JavaCard specification and eventually catch the exception (example for ALG_DES_CBC_NOPAD algorithm):

Code: Select all

 try {
      m_cipher = Cipher.getInstance(ALG_DES_CBC_NOPAD, false);
      // If this line is reached, than DES in CBC mode with no padding (ALG_DES_CBC_NOPAD) is supported.
      supported = true;
    }
    catch (CryptoException e) {
      if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM)) {
        // algorithm is not supported
        supported = false;
      }
      else {
        // other error occured
      }
    }


How to use it?
1, Upload AlgTest package to your smart card and install it. You may use pyApduTool to download cap and install applet .
2, Run AlgTestPC.exe, and choose the target reader for card with uploaded AlgTest applet and it can create a .*CSV file.
3, Open this *.cvs file, it shows as follows:

Code: Select all

Used reader;Feitian R502 Contact Reader 0
Card ATR;3B:61:00:00:80
                     
javacard.security.KeyPair ALG_RSA on-card generation;
ALG_RSA LENGTH_RSA_512;yes;0.538000
ALG_RSA LENGTH_RSA_736;no;
ALG_RSA LENGTH_RSA_768;yes;0.836000
ALG_RSA LENGTH_RSA_896;yes;0.855000
ALG_RSA LENGTH_RSA_1024;yes;0.683000
ALG_RSA LENGTH_RSA_1280;yes;1.051000
ALG_RSA LENGTH_RSA_1536;yes;6.204000
ALG_RSA LENGTH_RSA_1984;yes;8.506000
ALG_RSA LENGTH_RSA_2048;yes;6.188000
                     
javacard.security.KeyPair ALG_RSA_CRT on-card generation;
ALG_RSA_CRT LENGTH_RSA_512;yes;0.612000
ALG_RSA_CRT LENGTH_RSA_736;no;
ALG_RSA_CRT LENGTH_RSA_768;yes;0.945000
ALG_RSA_CRT LENGTH_RSA_896;yes;0.737000

......


Note:
1, This Automated testing tool for algorithms supported by particular smart card with JavaCard platform and is running in PC.
See Also:
The AlgTest Open Source Applet

Why my JCOP card failed?

Posted: Tue Aug 18, 2015 4:11 am
by Maarten
I use the pyApdutool to download the AlgTest.cap and install successfully, After I use AlgTestPC.exe according to the guide, all algorithms failed.
you can see the attachment as follows. can anyone tell me?


Re: Why my JCOP card failed?

Posted: Wed Aug 19, 2015 2:05 am
by Ellisun
Maarten wrote:I use the pyApdutool to download the AlgTest.cap and install successfully, After I use AlgTestPC.exe according to the guide, all algorithms failed.
you can see the attachment as follows. can anyone tell me?



This tool only supports T0, maybe your card protocol is T1, you can set the card protocol to T0 and test again.