2 Replies Latest reply: Apr 30, 2012 2:10 PM by 893199 RSS

    Install Applet to a physical JCOP card

    866883
      Hi,
      I have just developed my first applet and its running fine in my system. its a loyalty card :)
      I GOT .CAB file and sample JCOP card v2.2.

      1-How to deploy the applet into the card LOAD and INSTALL?
      2- what Keys has to be provided?
      3- I don't want to look the card manger so i can install another applet later.
      4-Is there any tool to do that?

      I have this piece of code but i don't really think it will work

      int JCOP::LoadApplet( char *appletFile, WORD instSize )
      {
           if (useLoadedApplet)
                return NO_ERROR;
           
           int res = Select( CardManagerAID, CardManagerAIDLen );
           if ( res )
                return res;

           BYTE cryp[8];
           res = InitializeUpdate( 0, 0, (PBYTE)"\x00\x00\x00\x00\x00\x00\x00\x00", cryp );
           if ( res )
                return res;
           res = ExternalAuthenticate( cryp );
           if ( res )
                return res;

           int size = Load( appletFile, true );
           BYTE loadParam[6] = { 0xEF, 0x04, 0xC6, 0x02, BYTE( size >> 8 ), BYTE( size ) };
           res = Install4Load( PackageAID, PackageAIDLen, NULL, 0, NULL, 0, loadParam, sizeof(loadParam) );
           if ( res )
                return res;

           res = Load( appletFile );
           if ( res )
                return res;

           res = Install( true, PackageAID, PackageAIDLen,
                CardAppletAID, CardAppletAIDLen,
                CardAppletIID, CardAppletIIDLen, 0, NULL, 0, instSize );
           if ( res )
                return res;

      //     res = PutKey( 1, UPDATE_KEY_123,
      //               (PBYTE)"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F",
      //               (PBYTE)"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F",
      //               (PBYTE)"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F" );
      //     if ( res )
      //          return res;
           return NO_ERROR;
      }

      Thanks

      Edited by: Hassan on Apr 23, 2012 1:27 AM