7 Replies Latest reply on Nov 11, 2010 10:51 PM by safarmer

    Call install method with apdutool

    811668
      Hi there,

      I am quite new to Java Cards and I have a problem when I try to call the install method using my script. I am using Netbeans by the way. Here you can observe my script.

      //Test script for Applet 'Test'

      powerup;

      // Select Test //aid/24450AE18C/84
      0x00 0xA4 0x04 0x00 0X06 0X24 0X45 0X0A 0XE1 0X8C 0X85 0x7F;

      // begin installer command
      // 0x80 0xB0 0x00 0x00 0x00 0x00;

      // create wallet applet
      0x80 0xB8 0x00 0x00 0x0D 0x06 0X24 0X45 0X0A 0XE1 0X8C 0X84 0x05 0x01 0x02 0x03 0x04 0x05 0x7F;

      // end installer command
      // 0x80 0xBA 0x00 0x00 0x00 0x00;

      powerdown;

      What I want to do is to call the install method of my applet to pass my arguments. The select apdu returns success but not the create wallet applet.

      An instance //aid/24450AE18C/85 is created for //aid/24450AE18C/84.
      CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 06, 24, 45, 0a, e1, 8c, 85, Le: 00, SW1: 90, SW2: 00
      // 0x80 0xB0 0x00 0x00 0x00 0x00;
      CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 06, 24, 45, 0a, e1, 8c, 85, 05, 01, 02, 03, 04, 05, Le: 00, SW1: 6e, SW2: 00
      // 0x80 0xBA 0x00 0x00 0x00 0x00;

      Can someone help me??


      Thanks in advance.

      Regards.
        • 1. Re: Call install method with apdutool
          safarmer
          Hi,

          If you can select your applet it is already installed. Are you using JCWDE or CREF to run your applet?

          Cheers,
          Shane
          1 person found this helpful
          • 2. Re: Call install method with apdutool
            811668
            First of all thanks for your answer.

            I am using the cref, that is the one coming with the JCDK3.0.2.
            Well, I had supposed that my applet was installed, but the thing is how can I someway call the install method so that I can pass it my parameters. I am trying to run the classic wallet application and with the install call I am supposed to pass the PIN to the applet:

            // create wallet applet
            0x80 0xB8 0x00 0x00 0x0D 0x06 0X24 0X45 0X0A 0XE1 0X8C 0X85 *0x05 0x01 0x02 0x03 0x04 0x05* 0x7F;

            If the applet is installed and I cannot use that apdu how can I pass to the applet my PIN or whatever initialization data I want to use ???

            Regards
            • 3. Re: Call install method with apdutool
              safarmer
              It is possible that you are using a ROM image that already has your applet installed (from a previous run?). You could try deleting your applet and re-install each time ignoring any applet not found errors (this is a standard approach).

              Cheers,
              Shane
              1 person found this helpful
              • 4. Re: Call install method with apdutool
                811668
                I don´t know why but I cannot delete my applet:

                CLA: 81, INS: c4, P1: 01, P2: 00, Lc: 07, 06, 24, 45, 0a, e1, 8c, dc, Le: 00, SW1: 69, SW2: 99
                CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 06, 24, 45, 0a, e1, 8c, dc, Le: 00, SW1: 90, SW2: 00

                What does it mean, that the applet is not installed at the beggining or what??
                • 5. Re: Call install method with apdutool
                  safarmer
                  808665 wrote:
                  I don´t know why but I cannot delete my applet:

                  CLA: 81, INS: c4, P1: 01, P2: 00, Lc: 07, 06, 24, 45, 0a, e1, 8c, dc, Le: 00, SW1: 69, SW2: 99
                  What APDU is that? If that is how you are trying to delete the applet it is never going to work. That is not even close to DELETE. Check the GP card spec, section 9.2.

                  Cheers,
                  Shane
                  • 6. Re: Call install method with apdutool
                    811668
                    Opps !!

                    I don´t know where I read this APDU but, yes, it was wrong obviously. Here I show what I am receiving now:
                    CLA: 80, INS: e4, P1: 00, P2: 80, Lc: 08, 4f, 06, 24, 45, 0a, e1, 8c, dc, Le: 00, SW1: 69, SW2: 99
                    CLA: 80, INS: e4, P1: 00, P2: 00, Lc: 08, 4f, 06, 24, 45, 0a, e1, 8c, dc, Le: 00, SW1: 69, SW2: 99

                    Ainsssssssss
                    • 7. Re: Call install method with apdutool
                      safarmer
                      You might want to try starting with a new EEPROM image for CREF each time. This way you know CREF is in a known state each time you start.

                      Cheers,
                      Shane