Page 1 of 1

AlgTest Instructions & Applet Source Code

Posted: Thu Jul 02, 2015 2:02 am
by JavaCardOS
JavaCard's algorithms support test

What it does:
  1. Provides list of supported algorithms from JavaCard API including supported lengths of keys
  2. Provides information about available RAM and EEPROM memory and garbage collection capabilities
  3. Provides basic speed tests for selected operations
Test possibility for using raw RSA for fast modular multiplication (usable to implement Diffie-Hellman for example)
The set of cryptographic algorithms supported by the particular Java smart card is sometimes hard obtain from vendor's specifications. Moreover, supported algorithms may change in more recent revisions of given type of card (typically, basic primitives like block cipher or asymmetric cryptography algorithm remains same as they are often implemented in hardware, but cryptographic constructions like particular MAC algorithm or supported key sizes may be added later). AlgTest application allows you to enumerate the support of cryptographic algorithms specified in JavaCard 2.2.2 and earlier.

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

For more information about this Applet, please see the attachment file.


  1. The Applet has been successfully compiled in JCIDE, can be directly use after download.
  2. For more details, you can visit "SourceForge" or "GitHub"

Re: AlgTest Instructions & Applet Source Code

Posted: Tue Sep 08, 2015 2:50 am
by JavaCardOS
This ALGTest version is V1.3, supporting Java Card Version is JC2.2.2.

  1. The project has been successfully compiled in JCIDE, The CAP file can be directly use.
  2. You can also visit GitHub or SourceForge.

Re: AlgTest Instructions & Applet Source Code

Posted: Fri Sep 11, 2015 2:18 am
by Tolice
The Applet in github and this forum exists some questions, I hava already optimized the applet with the version V1.3, and added garbage collection after setOutgoingAndSend(). The new version will continue to update, more information you can visit the GitHub.

Everyone can download this attachment.

Re: AlgTest Instructions & Applet Source Code

Posted: Fri Sep 11, 2015 8:59 pm
by Tolice
The new apllet source code with version v1.6.
It also add the garbage collection mechanism and exception handling to adapt to to more cards.