0 Replies Latest reply on Aug 16, 2017 3:53 PM by 53627dd3-d7e0-443b-a408-ed37fb799ad6

    Java card elliptic key generation causes Gemalto developer suite emulator or phone to freeze after the smart card(sim) is loaded.

    53627dd3-d7e0-443b-a408-ed37fb799ad6

      Hello,

      I am trying to perform Elliptic curve key generation in Java Card 2.2.1 using Gemalto Usim r5 development cards or Gemalto Developer suite emulator. The applet freezes in both the emulator and phone (after loading the applet using Gemalto Developer suite) on call to buildkey, genkeypair or even new keypair methods. The buildkey method works for des key generation. Setting breakpoint while debugging returns no message. Here's my code snippet. I would appreciate any help to fix this.

       

      Code snippet :

      ECPrivateKey epk;

      ECPublicKey epubk;

      epk= (ECPrivateKey)KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE, KeyBuilder.LENGTH_EC_FP_160, false);

      epubk= (ECPublicKey)KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PUBLIC,KeyBuilder.LENGTH_EC_FP_160 , false);

       

      KeyPair kp = new KeyPair(KeyPair.ALG_EC_FP, (short)20);

      kp.genKeyPair();

      ((ECPublicKey)kp.getPublic()).getW(ecPublicKey, (short)0);

      ((ECPrivateKey)kp.getPrivate()).getS(ecPrivateKey, (short)0);

       

      Aslo tried:

      kp = new KeyPair(KeyPair.ALG_EC_FP,KeyBuilder.LENGTH_EC_FP_160);

      kp.genKeyPair();

      epk = (ECPrivateKey) kp.getPrivate();

      epk.getS(ecPrivateKey, (short)0);

      epubk= (ECPublicKey) kp.getPublic();

      epubk.getW(ecPublicKey, (short)0);

       

      PS: ecPublicKey and ecPrivateKey are byte arrays initialized to size 20 in the constructor.

      Changing the ec_fp key sizes and also the ecPublicKey and ecPrivateKey byte array sizes did not help.

      The smart card used( the Gemalto sim card) supports JavaCard versions only until 3.0.1. I could only find specs for download for the version 3.0.1. Upgrading to 2.2.2 did not work as well.

       

      Thank you.