11 Replies Latest reply: Feb 20, 2012 3:07 AM by 917095 RSS

    JCOP41 applet installation

    917095
      Hi everyone,

      I need to install an applet on a JCOP41 card but I always get the same error when trying to load the applet on the javacard.

      I will give you all the sources if you want to test it.

      First the code of my applet:
      package myapplet;
      
      import javacard.framework.APDU;
      import javacard.framework.Applet;
      import javacard.framework.ISOException;
      
      public class MyApplet extends Applet {
      
           private MyApplet() {
           }
      
           public static void install(byte bArray[], short bOffset, byte bLength)
                     throws ISOException {
                new MyApplet().register();
           }
      
           // @Override
           public void process(APDU arg0) throws ISOException {
                // TODO Auto-generated method stub
           }
      }
      I know, it's empty, it's just for testing.

      Then I generate the corresponding cap file myapplet.cap.

      Finally, I want to install this cap file on the JCOP using a script similar to the helloworld example:
      mode_211
      enable_trace
      enable_timer
      
      establish_context
      card_connect
      select -AID a000000003000000
      open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f // Open secure channel
      install -file myapplet.cap -nvDataLimit 2000 -instParam 00 -priv 2
      # getdata
      # close_sc // Close secure channel
      # putkey // Put key
        // options:
        //          -keyind Key index
        //          -keyver Key version
        //          -key Key value in hex
      card_disconnect
      release_context
      And I always get the same error. Here is the full trace:
      mode_211
      enable_trace
      enable_timer
      establish_context
      command time: 0 ms
      card_connect
      command time: 16 ms
      select -AID a000000003000000
      Command --> 00A4040008A000000003000000
      Wrapped command --> 00A4040008A000000003000000
      Response <-- 6F658408A000000003000000A5599F6501FF9F6E06405163452900734A06072A864
      886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640B06092A864886FC6B0
      40215650B06092B8510864864020103660C060A2B060104012A026E01029000
      command time: 46 ms
      open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4
      f -enc_key 404142434445464748494a4b4c4d4e4f // Open secure channel
      Command --> 80CA006600
      Wrapped command --> 80CA006600
      Response <-- 664C734A06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864
      886FC6B03640B06092A864886FC6B040215650B06092B8510864864020103660C060A2B060104012
      A026E01029000
      Command --> 8050000008585BC86E6E0EAF1300
      Wrapped command --> 8050000008585BC86E6E0EAF1300
      Response <-- 00000177003766952799FF02004B4B698858850FD504E54074EC8C709000
      Command --> 848201001056194DA38EA07C5256CDFB3F540EB038
      Wrapped command --> 848201001056194DA38EA07C5256CDFB3F540EB038
      Response <-- 9000
      command time: 250 ms
      install -file myapplet.cap -nvDataLimit 2000 -instParam 00 -priv 2
      Command --> 80E60200210A0102030405060708090008A000000003000000000AEF08C6020108C8
      0207D00000
      Wrapped command --> 84E60200290A0102030405060708090008A000000003000000000AEF08C6
      020108C80207D000751F5C332DA8F18E00
      Response <-- 009000
      Command --> 80E80000EFC481FE8200FE010014DECAFFED01020400010A01020304050607080900
      02001F0014001F000F00150012000C0018000A000800000041000000000000020100040015020301
      07A0000000620101000107A000000062000103000F010B0102030405060708090000000806000C00
      800300FF00070100000015070018000110188C00007A02308F00013D8C00028B00037A00207A0800
      0A000000000000000000000500120004068003000100000006000001038003010900080000000405
      0604030B004101000100000000000003FF820001000A00050000000000090008000C000B00000000
      07010015000F00010000
      Wrapped command --> 84E80000F7C481FE8200FE010014DECAFFED01020400010A010203040506
      0708090002001F0014001F000F00150012000C0018000A0008000000410000000000000201000400
      1502030107A0000000620101000107A000000062000103000F010B01020304050607080900000008
      06000C00800300FF00070100000015070018000110188C00007A02308F00013D8C00028B00037A00
      207A08000A0000000000000000000005001200040680030001000000060000010380030109000800
      000004050604030B004101000100000000000003FF820001000A00050000000000090008000C000B
      0000000007010015000F00010000F4839C8BB3E25AC1
      Response <-- 6A80
      load() returns 0x80206A80 (6A80: Wrong data / Incorrect values in command data.)
      It seems the installation fails, but I don't know why. What bothers me is that the helloworld.cap file provided as example works, but none of the .cap files I generate myself does. Maybe there's something wrong with the way I generate those files.

      Any idea regarding the error returned?

      Thanks