APDU error 6a80

Hi there, i'm new to javacard technology and i'm trying to run the wallet.java example usingEclipse. I get an error message of 6a80 when i try to debug the app. Does anyone have any ideas of what the problem could be? I havent changed any of the code in the example!!!

I don't know Eclipse, but I had something similar in the Aspects IDE. Basically you need to select a target device first before starting to debug (because the SW obviously must know what sort of card to simulate). Aspects had a bunch of possible targets (including connections to external card readers), but selecting any GlobalPlatform sim-type does the trick.

Similar Messages

  • IP3600 Service Error 6A80

    I was hoping someone can help me out. I purchased my IP3600 back on December 9th of 2012 and have never had much of an issue nor a single jam problem with this printer (unlike my HP). That is...until this morning.
    Basically, I do home made hot sauces and my IP3600 handles the print runs of labels for the bottles. So this morning I had hooked up the printer as usual, but unlike all the other times for the past year or so, this time my printer refuses to work. 
    When connected and turned on, the green light blinks and you can hear all of its mechanical goodness as it's doing its usual warm up thing and then the green light stops blinking and goes solid green to show it's ready for printing. If the printer has sat for a long time, I typically do a quick cleaning to ensure the labels print correctly and the ink is flowing as it should. Only when I tried this morning, it's now popping up with:
    "SERVICE ERROR 6A80. Cancel printing and turn the printer off then on again. If this doesn't clear the error, see the printer manual for more detail."
    I do as directed, and afterwards try to do anything with the printer and it kicks up the same Error 6A80. I tried completely disconnecting everything from the printer and let it sit for 10-15 minutes. Hooked it back up, turned it on, but instead of doing a cleaning I tried to print a picture. It printed the picture just fine and afterwards I noticed the green and yellow lights blinking again and I suddenly got the 6A80 error box. WEIRD! I tried looking at the manual and couldn't find anything. And when I googled this issue, what little I managed to find on it, the tips mentioned are for other Canon printers that have a number pad to hold down and whatnot. All I have is the power button and the cancel button. 
    I also noticed the green and yellow lights are blinking in an alternating pattern: 12 green and 12 yellow blinks. (yellow, green, yellow, green....so on and so forth). 
    I'm really at a  loss here, and needless to say it has  halted production since I can't print. If there is anything that can be tried--even if unofficial home tips--I'd greatly appreciate it. 
    Regards,
    John Finlay

    Just a quick update. I tried turning it off and letting it sit for awhile and turn it back on. This time the printhead moved all the way to the right and then I had the 6A80 error. The major problem with that is, now the printhead is stuck on the right hand side of the printer and can't move. I tried powering down and moving it manually but there is no "give" to it. If I put pressure to push it in more or try pulling it out it's just a plastic sound, so I stopped out of fear of snapping something.
    I'm wondering if when the error happened as the printer was doing its thing sliding the printhead on startup it sort of locked when the error happened. And now I can't clear the error to get it unstuck/unlocked. Soon as you plug all the cables back in and power it on, the green and yellow lights start blinking. 

  • Load error 6A80

    Hi everyone,
    I am using the following:
    a) Gemalto Cyberflex Access 64k v2 Java card
    b) GPshell 1.4.4
    c) JC 2.1.1
    d) Captransfer - this is required on this cyberflex card. This basically further processes a CAP file.
    I have tested my applet on the APDUtool for JC 2.1.1 and my applet works fine. However, while loading on my
    Gemalto card, I am getting error 6A80 - Wrong data/ Incorrect values in command data.
    I have installed one other applet and that installed fine on the java card.
    The only difference i see is in the AID of the applets - I wonder if some AID's cannot be used - I am not sure. Apart from that, I compiled, converted and used the Captransfer in exactly the same way - one applet installed, while the other failed.
    Please help me out.
    Thanks much
    Cheers

    858087 wrote:
    Can someone please tell me as to how large a transient array can be? I need a large data array. Someone please help.In theory 32KB (according to the maximum array size in the JCVM specification). In practice the amount or RAM (as mentioned by Sebastien) is the limiting factor. You can check by trial and error. Allocate more memory until it fails.
    Cheers,
    Shane

  • Error 6A80 when loading applet to my card

    Hi everyone,
    First, please excuse me for my bad english, i'm french.
    So, i'm trying to upload an applet to my eGate CyberFlex 32K JavaCard, but some code lines causes 6A80 error.
    Here is my applet source (it's just a first test ;-) ) :
    package applet;
    import javacard.framework.*;
    public class TheApplet extends Applet {
        private final static byte CARD_CLA      = (byte)0x80;
        private final static byte INS_TEST      = (byte)0x02;
        private final static byte PIN_TRY_LIMIT = (byte)0x03;
        private final static byte MAX_PIN_SIZE  = (byte)0x04;
        final static short SW_PIN_VERIFICATION_REQUIRED = 0x6301;
        protected byte[] name = {'T', 'e', 's', 't'};
        private OwnerPIN pin;
        protected TheApplet() throws PINException {
            this.register();
            pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);
            byte[] pins = {(byte)0, (byte)0, (byte)0, (byte)0};
            pin.update(pins, (short)0, MAX_PIN_SIZE);
            byte i = pin.getTriesRemaining();
            //pin.check(pins, (short)0, MAX_PIN_SIZE); // CAUSES 6A80 error when loading
        public static void install (byte[] bArray, short bOffset, byte bLength)
        throws ISOException {
            new TheApplet();
        public boolean select() {
            /*if (pin.getTriesRemaining() == 0) { // CAUSES 6A80 error too..
                return false;
            return true;
        public void process(APDU apdu) throws ISOException, PINException {
            byte[] buffer = apdu.getBuffer();
            if (selectingApplet() == true) {
                return;
            if (buffer[ISO7816.OFFSET_CLA] != CARD_CLA) {
                ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
            if (buffer[ISO7816.OFFSET_INS] != INS_TEST) {
                ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
            //pin.isValidated(); // Causes error.
            apdu.setOutgoing();
            apdu.setOutgoingLength((short)name.length);
            apdu.sendBytesLong(name, (short)0, (short)name.length);
    }In fact, all access to pin causes error when loading, when commented lines are uncommented, the applet loads successfully.
    Do you know what the problem is ?
    I'm using JavaCard 2.1.2, and GPshell 1.4.2.
    This is the gpshell script :
    echo mode_201 > $OUT/config.txt
    echo establish_context >> $OUT/config.txt
    echo card_connect >> $OUT/config.txt
    echo select -AID $CARDSECURITYDOMAIN2 >> $OUT/config.txt
    echo open_sc -security 1 -keyind 0 -keyver 0 -mac_key $CARDKEY -enc_key $CARDKEY >> $OUT/config.txt
    echo install_for_load -pkgAID $PACKAGEAID -nvCodeLimit 500 >> $OUT/config.txt
    echo load -file $OUT/$PROJECT/$PKGAPPLET/javacard/$PKGAPPLET.cap.transf >> $OUT/config.txt
    echo install_for_install -instParam 00 -priv 02 -AID $APPLETAID -pkgAID $PACKAGEAID -instAID $APPLETAID -nvDataLimit 500 >> $OUT/config.txt
    echo card_disconnect >> $OUT/config.txt
    echo release_context >> $OUT/config.txtwith :
    CARDKEY=404142434445464748494A4B4C4D4E4F
    APPLETAID=A00000006203010C0601
    PACKAGEAID=A00000006203010C06The error i got is :
    load_applet() returns 0x80206A80 (6A80: Wrong data / Incorrect values in command data.)Thank you for your help.
    Edited by: Anakim14 on Apr 20, 2009 3:12 AM

    up.

  • Problem during loadgae of file

    Hello,
    I am trying to modify Loader.java sample to load simple HelloWorld applet to the
    JCOP simulator.
    During the execution the problem with call to the installForInstallAbdMakeSelectable aperas. The error code returned by he simulator is just 6a80 (Wrong data). I cant't find out what is the problem... Maybe anyone could help me?
    So here is the code of my program, that shoul load and install applet, also make it selectable:
    public class Loader
        private Loader(){}
        private void load(String capFileName) throws Exception
              CapFile capFile = new CapFile(capFileName, null);
              System.out.println("Package name: " + capFile.pkg);
              byte[][] applets = capFile.aids;
              if ((applets == null) || (applets.length == 0))
                  throw new RuntimeException("no applets in cap file");
              // Get connection to terminal, we look for the simulation.
              // As you might want to use "pcsc", "4" or "tcl", "10" in case of
              // Windows or "PCSC", null in case of Linux, you should pass the name
              // of the terminal on the command line or in a properties file
              System.out.println("Open terminal ...");
              JCTerminal term = JCTerminal.getInstance("Remote", null);
              term.open();
              // Create a logging terminal spitting out the APDUs on standard out
              TraceJCTerminal _term = new TraceJCTerminal();
              _term.setLog(new PrintWriter(System.out));
              _term.init(term);
              term = _term;
              // Get JavaCard representative, passing NULL resets card and returns ATR
              System.out.println("Get card ...");
              JCard card = new JCard(term, null, 2000);
              // Get the off-card representative for the card manager and use it to
              // select the on-card CardManager
              System.out.println("Select card manager ...");
              CardManager cardManager = new CardManager(card, CardManager.daid);
              cardManager.select();
              // For downloading something, we have to be authenticated to card manager.
              // For this, the keys must be set. The keys to use should of course
              // be configurable as well.
              byte[] dfltKey = c2b("404142434445464748494a4b4c4d4e4f");
              cardManager.setKey(new OPKey(255, 1, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(255, 2, OPKey.DES_ECB, dfltKey));
              cardManager.setKey(new OPKey(255, 3, OPKey.DES_ECB, dfltKey));
              //cardManager.setKey(new OPKey(1, 1, OPKey.DES_ECB, c2b("707172737475767778797a7b7c7d7e7f")));
              //cardManager.setKey(new OPKey(1, 2, OPKey.DES_ECB, c2b("606162636465666768696a6b6c6d6e6f")));
              cardManager.setKey(new OPKey(1, 3, OPKey.DES_ECB, c2b("505152535455565758595a5b5c5d5e5f")));
              System.out.println("Authenticate to card manager ...");
              cardManager.initializeUpdate(255, 0, OPApplet.SCP_UNDEFINED);
              cardManager.externalAuthenticate(OPApplet.APDU_CLR);
              System.out.println("deleting applets");
              cardManager.deleteObject(capFile.pkgId, 0, capFile.pkgId.length, true);
              System.out.println("applets deleted");
              // And load the cap-file, do not forget to call installForLoad
              System.out.println("Loading cap-file ..."+capFile.pkg);
              cardManager.installForLoad(capFile.pkgId, 0, capFile.pkgId.length, null, 0, 0, null, 0, null, 0, 0, null, 0);
              cardManager.load(capFile, null, SecurityDomain.LOAD_ALL, new PrintWriter(System.out), 250);
              System.out.println("Finished loading !");
              // Install applet, we try to install the first applet given in the
              // cap file, and try to instantiate it under the same AID as given for its
              // representation in the cap file. No installation data is passed.
              System.out.println("Installing applet ...");
              cardManager.installForInstallAndMakeSelectable     //HERE EXCEPTION APPEARS
                        capFile.pkgId,
                        0,
                        capFile.pkgId.length,
                        applets[0],
                        0,
                        applets[0].length, /* applet */
                        applets[0],
                        0,
                        applets[0].length, /* instance aid */
                        OPApplet.NO_PRIVS,  /* no special priviledges */
                        null,
                        0,
                        0,   /* install data */
                        null,
                        0
              System.out.println("Install succeeded!");
              // synchronize state with on-card card manager
              cardManager.update();
              // Print information regarding card manager, applets and packages on-card
              JCInfo info = JCInfo.INFO;
              System.out.println("\nCardManager AID   :  " + info.dataToString(cardManager.getAID()));
              System.out.println("CardManager state :  " + info.toString("card.status", (byte) cardManager.getState()) + "\n");There is the reaply of the smulator:
    Open terminal ...
    Get card ...
    --Waiting for card...
    Select card manager ...
    ATR=3B FA 13 00 00 81 31 FE 45 4A 43 4F 50 34 31 56    ;.....1.EJCOP41V
        32 32 31 96                                        221.
    => 00 A4 04 00 07 A0 00 00 00 03 00 00 00             .............
    (0 msec)
    <= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65    o..............e
        01 FF 90 00                                        ....
    Status: No Error
    Authenticate to card manager ...
    => 80 50 00 00 08 A9 2D 23 0F 2E CD 55 7A 00          .P....-#...Uz.
    (0 msec)
    <= 00 00 57 F3 97 D9 7F 72 88 55 FF 02 00 20 BA 9A    ..W....r.U... ..
        16 94 77 B9 81 CE 96 61 84 55 71 73 90 00          ..w....a.Uqs..
    Status: No Error
    => 84 82 00 00 10 18 F1 1A 0C 97 BD D1 66 8B 43 41    ............f.CA
        46 39 44 85 9C                                     F9D..
    (0 msec)
    <= 90 00                                              ..
    Status: No Error
    deleting applets
    => 80 E4 00 80 0C 4F 0A 48 65 6C 6C 6F 57 6F 72 6C    .....O.HelloWorl
        64 00                                              d.
    (0 msec)
    <= 00 90 00                                           ...
    Status: No Error
    applets deleted
    Loading cap-file ...com.sun.javacard.samples.HelloWorld
    => 80 E6 02 00 0F 0A 48 65 6C 6C 6F 57 6F 72 6C 64    ......HelloWorld
        00 00 00 00 00                                     .....
    (0 msec)
    <= 00 90 00                                           ...
    Status: No Error
    => 80 E8 00 00 FA C4 82 01 57 01 00 38 DE CA FF ED    ........W..8....
        02 02 04 00 01 0A 48 65 6C 6C 6F 57 6F 72 6C 64    ......HelloWorld
        23 63 6F 6D 2F 73 75 6E 2F 6A 61 76 61 63 61 72    #com/sun/javacar
        64 2F 73 61 6D 70 6C 65 73 2F 48 65 6C 6C 6F 57    d/samples/HelloW
        6F 72 6C 64 02 00 21 00 38 00 21 00 12 00 0B 00    orld..!.8.!.....
        36 00 0E 00 65 00 0A 00 13 00 00 00 6E 02 9A 00    6...e.......n...
        00 00 00 00 00 01 01 00 04 00 0B 01 02 01 07 A0    ................
        00 00 00 62 01 01 03 00 12 01 0E 48 65 6C 6C 6F    ...b.......Hello
        57 6F 72 6C 64 41 70 70 6C 00 14 06 00 0E 00 00    WorldAppl.......
        00 80 03 01 00 01 07 01 00 00 00 1D 07 00 65 00    ..............e.
        02 10 18 8C 00 07 18 11 01 00 90 0B 87 00 18 8B    ................
        00 05 7A 01 30 8F 00 03 8C 00 0A 7A 05 23 19 8B    ..z.0......z.#..
        00 08 2D 19 8B 00 02 32 03 29 04 70 19 1A 08 AD    ..-....2.).p....
        00 16 04 1F 8D 00 01 3B 16 04 1F 41 29 04 19 08    .......;...A)...
        8B 00 09 32 1F 64 E8 19 8B 00 06 3B 19 16 04 08    ...2.d.....;....
        41 8B 00 04 19 03 08 8B 00 0B 19 AD 00 03 16 00    A...............
    (0 msec)
    <= 00 90 00                                           ...
    Status: No Error
    => 80 E8 80 01 61 04 8B 00 0C 7A 08 00 0A 00 00 00    ....a....z......
        00 00 00 00 00 00 00 05 00 36 00 0D 02 00 02 00    .........6......
        06 80 10 02 03 80 0A 06 01 00 02 00 03 80 0A 09    ................
        03 80 03 01 03 80 0A 07 06 80 03 00 03 80 0A 01    ................
        03 80 0A 03 06 00 00 01 03 80 0A 04 03 80 0A 05    ................
        09 00 13 00 03 0E 23 2C 00 0C 05 0C 06 03 07 05    ......#,........
        10 0C 08 09 06 09 00                               .......
    (16 msec)
    <= 00 90 00                                           ...
    Status: No Error
    Finished loading !
    Installing applet ...
    => 80 E6 0C 00 2D 0A 48 65 6C 6C 6F 57 6F 72 6C 64    ....-.HelloWorld
        0E 48 65 6C 6C 6F 57 6F 72 6C 64 41 70 70 6C 0E    .HelloWorldAppl.
        48 65 6C 6C 6F 57 6F 72 6C 64 41 70 70 6C 01 00    HelloWorldAppl..
        00 00 00                                           ...
    (0 msec)
    <= 6A 80                                              j.
    Status: Wrong data
    EX: msg null, class class com.ibm.jc.JCException
    com.ibm.jc.JCException:
      Error: 6a80
      APDU:  6A80
            at com.ibm.jc.JCUtil.check9000(Unknown Source)
            at com.ibm.jc.SecurityDomain.handleInstall(Unknown Source)
            at com.ibm.jc.SecurityDomain.installForInstallAndMakeSelectable(Unknown
    Source)
            at loader.Loader.load(Loader.java:93)
            at loader.Loader.main(Loader.java:187)Please, help me, I don't get it, ehat could be wrong in this sample?

    Yes, I did.
    Below are the results of HelloWorldAppl loading to Java Card in JCOP Shell simulations process.
    -  /term "Remote|localhost:1175"
    --Opening terminal
    /card -a a000000003000000 -c com.ibm.jc.CardManagerresetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B FA 13 00 00 81 31 FE 45 4A 43 4F 50 34 31 56    ;.....1.EJCOP41V
        32 32 31 96                                        221.
    ATR: T=1, FI=1/DI=3 (93clk/etu), N=0, IFSC=254, BWI=4/CWI=5, Hist="JCOP41V221"
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00          ..............
    (0 msec)
    <= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65    o..............e
        01 FF 90 00                                        ....
    Status: No Error
    cm>  set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm>  init-update 255
    => 80 50 00 00 08 E6 F0 56 27 06 B6 C6 42 00          .P.....V'...B.
    (0 msec)
    <= 00 00 57 F3 97 D9 7F 72 88 55 FF 02 00 00 3D 02    ..W....r.U....=.
        9C 31 C7 89 6E 2E 4E BD 56 FB A4 9A 90 00          .1..n.N.V.....
    Status: No Error
    cm>  ext-auth plain
    => 84 82 00 00 10 6B FC E2 0E 7D 91 7F 9E DD 09 6A    .....k...}.....j
        90 D0 2C D6 E9                                     ..,..
    (16 msec)
    <= 90 00                                              ..
    Status: No Error
    cm>  delete 48656c6c6f576f726c644170706c
    => 80 E4 00 00 10 4F 0E 48 65 6C 6C 6F 57 6F 72 6C    .....O.HelloWorl
        64 41 70 70 6C 00                                  dAppl.
    (0 msec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete 48656c6c6f576f726c64
    => 80 E4 00 00 0C 4F 0A 48 65 6C 6C 6F 57 6F 72 6C    .....O.HelloWorl
        64 00                                              d.
    (0 msec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  upload -b 250 "C:\Documents and Settings\Ieva\workspace\HelloWorld\bin\com\sun\javacard\samples\HelloWorld\javacard\HelloWorld.cap"
    => 80 E6 02 00 17 0A 48 65 6C 6C 6F 57 6F 72 6C 64    ......HelloWorld
        08 A0 00 00 00 03 00 00 00 00 00 00 00             .............
    (31 msec)
    <= 00 90 00                                           ...
    Status: No Error
    => 80 E8 00 00 FA C4 82 01 57 01 00 38 DE CA FF ED    ........W..8....
        02 02 04 00 01 0A 48 65 6C 6C 6F 57 6F 72 6C 64    ......HelloWorld
        23 63 6F 6D 2F 73 75 6E 2F 6A 61 76 61 63 61 72    #com/sun/javacar
        64 2F 73 61 6D 70 6C 65 73 2F 48 65 6C 6C 6F 57    d/samples/HelloW
        6F 72 6C 64 02 00 21 00 38 00 21 00 12 00 0B 00    orld..!.8.!.....
        36 00 0E 00 65 00 0A 00 13 00 00 00 6E 02 9A 00    6...e.......n...
        00 00 00 00 00 01 01 00 04 00 0B 01 02 01 07 A0    ................
        00 00 00 62 01 01 03 00 12 01 0E 48 65 6C 6C 6F    ...b.......Hello
        57 6F 72 6C 64 41 70 70 6C 00 14 06 00 0E 00 00    WorldAppl.......
        00 80 03 01 00 01 07 01 00 00 00 1D 07 00 65 00    ..............e.
        02 10 18 8C 00 07 18 11 01 00 90 0B 87 00 18 8B    ................
        00 05 7A 01 30 8F 00 03 8C 00 0A 7A 05 23 19 8B    ..z.0......z.#..
        00 08 2D 19 8B 00 02 32 03 29 04 70 19 1A 08 AD    ..-....2.).p....
        00 16 04 1F 8D 00 01 3B 16 04 1F 41 29 04 19 08    .......;...A)...
        8B 00 09 32 1F 64 E8 19 8B 00 06 3B 19 16 04 08    ...2.d.....;....
        41 8B 00 04 19 03 08 8B 00 0B 19 AD 00 03 16 00    A...............
    (16 msec)
    <= 00 90 00                                           ...
    Status: No Error
    => 80 E8 80 01 61 04 8B 00 0C 7A 08 00 0A 00 00 00    ....a....z......
        00 00 00 00 00 00 00 05 00 36 00 0D 02 00 02 00    .........6......
        06 80 10 02 03 80 0A 06 01 00 02 00 03 80 0A 09    ................
        03 80 03 01 03 80 0A 07 06 80 03 00 03 80 0A 01    ................
        03 80 0A 03 06 00 00 01 03 80 0A 04 03 80 0A 05    ................
        09 00 13 00 03 0E 23 2C 00 0C 05 0C 06 03 07 05    ......#,........
        10 0C 08 09 06 09 00                               .......
    (16 msec)
    <= 00 90 00                                           ...
    Status: No Error
    Load report:
      347 bytes loaded in 0.1 seconds
      effective code size on card:
          + package AID       10
          + applet AIDs       21
          + classes           17
          + methods           104
          + statics           0
          + exports           0
            overall           152  bytes
    cm>  install -i 48656c6c6f576f726c644170706c  -q C9#() 48656c6c6f576f726c64 48656c6c6f576f726c644170706c
    => 80 E6 0C 00 2F 0A 48 65 6C 6C 6F 57 6F 72 6C 64    ..../.HelloWorld
        0E 48 65 6C 6C 6F 57 6F 72 6C 64 41 70 70 6C 0E    .HelloWorldAppl.
        48 65 6C 6C 6F 57 6F 72 6C 64 41 70 70 6C 01 00    HelloWorldAppl..
        02 C9 00 00 00                                     .....
    (0 msec)
    <= 90 00                                              ..
    Status: No Error
    cm>  card-info
    => 80 F2 80 00 02 4F 00 00                            .....O..
    (0 msec)
    <= 08 A0 00 00 00 03 00 00 00 01 9E 90 00             .............
    Status: No Error
    => 80 F2 40 00 02 4F 00 00                            [email protected]..
    (0 msec)
    <= 0E 48 65 6C 6C 6F 57 6F 72 6C 64 41 70 70 6C 07    .HelloWorldAppl.
        00 90 00                                           ...
    Status: No Error
    => 80 F2 10 00 02 4F 00 00                            .....O..
    (0 msec)
    <= 07 A0 00 00 00 03 53 50 01 00 01 08 A0 00 00 00    ......SP........
        03 53 50 41 0A 48 65 6C 6C 6F 57 6F 72 6C 64 01    .SPA.HelloWorld.
        00 01 0E 48 65 6C 6C 6F 57 6F 72 6C 64 41 70 70    ...HelloWorldApp
        6C 90 00                                           l..
    Status: No Error
    Card Manager AID   :  A000000003000000
    Card Manager state :  OP_READY
        Application:  SELECTABLE (--------) "HelloWorldAppl"
        Load File  :      LOADED (--------) A0000000035350   (Security Domain)
         Module    :                        A000000003535041
        Load File  :      LOADED (--------) "HelloWorld"   
         Module    :                        "HelloWorldAppl"
    cm>  /select |HelloWorldAppl
    => 00 A4 04 00 0E 48 65 6C 6C 6F 57 6F 72 6C 64 41    .....HelloWorldA
        70 70 6C 00                                        ppl.
    (0 msec)
    <= 00 A4 04 00 0E 48 65 6C 6C 6F 57 6F 72 6C 64 41    .....HelloWorldA
        70 70 6C 90 00                                     ppl..
    Status: No ErrorEverything works fine. That's why, I don't get it, where mistake is made.
    The only logical consumption is, that there are maybe some mistakes in my OffCard API Java code?!
    May be anyone has well-working Java OffCard sample, that loads and installs applet (also makes it selectable)?
    Best regards,
    Eve

  • JavaCard

    Hi there, i'm new to javacard technology and i'm trying to run the wallet.java example usingEclipse. I get an error message of 6a80 when i try to debug the app. Does anyone have any ideas of what the problem could be? I havent changed any of the code in the example!!!

    I've already checked the ISO 7816-4 standard for the APDU error code but i cant understand why its giving me the error when i havent changed any code in the example! I've written a small app of my own and i get the same error when trying to debug it aswell. I think its a problem with the install method but i cant be sure as i dont have enough experience with Javacard.

  • Applet Reinstallation

    Hi ,
    Iam already load one applet to the GemCombixpresso R4 card using GPShell
    and next i want to upload another applet ...
    Do i need to delete the existing applet?I tried to deleting Pkg and applet..
    when i tried to delete the applet and load the another applet,it is giving error 6A80...
    what's the problem?

    Please provide an APDU trace. I assume you deleted the applet only and tried to load the package with the applet again. You need to delete the applet first, then the package. Alternatively you can use (if supported by the implementation) the enhanced GP DELETE command, deleting object and all related objects; this means you apply this delete to the package and it will delete all applets having a dependency with this package as well.
    If your applet did not change, you don't need to load it, just instantiate out of a package module.

  • Generating a certification signing request

    Hi all,
    I am currently writting a Java Card application and I would like to create a CSR but my private key shouldn't leave the card. However, for signing a CSR I need a private key. In Java Card API I found no suport for something like this. Any idea how to solve this problem? Btw. I am using a JCOP 41 card for development.
    Thanks,
    erno
    Edited by: sect0r1 on Mar 27, 2010 6:11 AM

    Hi Shane,
    thank you for your reply!
    I think is the fifth step which I do not understand:
    safarmer wrote:
    5. Build a DigestInfo structure (BER encoded TLV that you can get from the PKCS#1 standard) that contains the message digest generated in the previous step What I do is create the message digest and send it to the card to be signed. But when I try to sign the csr with openssl, the following error appears: "Signature did not match the certificate request"
    As you told me the applet only encrypt the hashcode:
    RSACipher.init(PrivateKey,Cipher.MODE_ENCRYPT); 
    RSACipher.doFinal(CSR,(short)0,(short)CSR.length,CSRSigned,(short)0);And the off-card code for preparing the CSR after getting the public key is the following:
            private static void prepareEncCSR (CadT1Client cad){
             byte [] encCSR = null;
             Signature signature = null;
         // signature is not initialized because CSR is not going to be signed here; if not on the card.
         signature = Signature.getInstance("SHA1withRSA");
         // Build the info.
         String info = "CN=cn, OU=ou, O=o, C=cn, ST=city";
             X500Principal x500 = new X500Principal(info);
             X500Name x500name = null;
         x500name = new X500Name(x500.getEncoded());
         X500Signer x500signer = new X500Signer(signature, x500name);
             // Build an instance of pkcs10 with the public key from the card.
             PKCS10 pkcs10 = new PKCS10(PubKey);
         // Encode and sign the certificate request.
         encCSR = encodeAndSign(x500signer, pkcs10, cad);
         FileOutputStream certfos = null;
         // Create the file where the certification request will be stored.
         certfos = new FileOutputStream("CertReq.pem");
             PrintStream ps = new PrintStream(certfos);
             // Encode the CSR properly using base 64 code.
             BASE64Encoder   encoder = new BASE64Encoder();
             ps.println("-----BEGIN NEW CERTIFICATE REQUEST-----");
         encoder.encodeBuffer(encCSR, ps);
         ps.println("-----END NEW CERTIFICATE REQUEST-----");
             ps.close();
         certfos.close();
        public static byte [] encodeAndSign(X500Signer requester, PKCS10 pkcs10, CadT1Client cad)
        throws CertificateException, IOException, SignatureException
                DerOutputStream out, scratch;
                byte [] certificateRequestInfo;
                byte [] sig;
                byte [] encCSR;
                X500Name subject = requester.getSigner();
                // Encode CSR info, wrap in a sequence for being signed.           
                scratch = new DerOutputStream();
                // PKCS #10 v1.0.
                scratch.putInteger(BigInteger.ZERO);
                // X.500 name.
                subject.encode(scratch);
                // Public key.
                Key subjectPublicKeyInfo = pkcs10.getSubjectPublicKeyInfo();
                   scratch.write(subjectPublicKeyInfo.getEncoded());
                PKCS10Attributes attributeSet = new PKCS10Attributes();
                   attributeSet.encode(scratch);
                out = new DerOutputStream();
                // Wrap it.
                out.write(DerValue.tag_Sequence, scratch);
                certificateRequestInfo = out.toByteArray();
                scratch = out;
                // Send certificateRequestInfo to the card in order to be signed by the private key.
                // Create a SHA1 hash of the CSR
                MessageDigest csrMD = null;
                csrMD = MessageDigest.getInstance("SHA");
                csrMD.update(certificateRequestInfo);
                byte[] hashCodeCSR = csrMD.digest();
                // Send APDU command to the smart card to ask it for signing the request.
                 Apdu apdu = new Apdu();
                 prepareAPDU (apdu, PROCESS_SIGN_CERT_REQUEST_INS);
                // Add hash code to be signed to the APDU data.
                 apdu.setDataIn(hashCodeCSR);
                 exchangeAPDUs (apdu, cad);
                 checkAPDUStatus (apdu, "Error asking for signing CSR");
                 // Get the data sent in the APDU response.
                 sig = apdu.getDataOut();
                 // Add signature algorithm.
                requester.getAlgorithmId().encode(scratch);
                // Add signature and marshals DER bit string.
                scratch.putBitString(sig);
                // Wrap those guts in a sequence.
                out = new DerOutputStream();
                out.write(DerValue.tag_Sequence, scratch);
                encCSR = out.toByteArray();
                return encCSR;
        }The encodeAndSign is similar to this encodeAndSign , but modified to be adapted to what I need.
    I do not understand which is the problem at all, could you help me? Taking in account the openssl's reply, I think the problem is in the way to sign.
    Thank you in advance,
    E_L

  • Upload external  cap file: jcshell: Error code: 6a80 (Wrong data)?

    Hi,
    i use eclipse + NXP JCOP Plugins_Generic3.2.8_Target ,the card is jcop31v232.
    if the cap file is generated by eclipse project , when i upload exteral cap file ,no error
    but if the cap file is generated by converter command ,there is  error
    what error?help me
    cm> /terminal "winscard:4|Feitian R502 Contact Reader 1"
    --Opening terminal
    /card -a a000000003000000 -c com.ibm.jc.CardManager
    resetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B FA 13 00 00 81 31 FE 45 4A 43 4F 50 33 31 56 ;.....1.EJCOP31V
    32 33 32 93 232.
    IOCTL().
    ATR: T=1, FI=1/DI=3 (93clk/etu), N=0, IFSC=254, BWI=4/CWI=5, Hist="JCOP31V232"> => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00 ..............
    (104154 usec)
    <= 6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 oe...........Y.e
    01 FF 9F 6E 06 47 91 73 51 2E 00 73 4A 06 07 2A ...n.G.sQ..sJ..*
    86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B .H..k.`...*.H..k
    02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 ....c...*.H..k.d
    0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 ...*.H..k...e...
    2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 +...Hd...f...+..
    04 01 2A 02 6E 01 02 90 00 ..*.n....
    Status: No Error
    cm> set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm> init-update 255
    => 80 50 00 00 08 A7 C7 04 88 8C 87 3F DE 00 .P.........?..
    (68417 usec)
    <= 00 00 93 36 01 29 05 95 13 05 FF 02 00 5F E1 48 ...6.)......._.H
    67 60 FD 2F 89 FF AD A4 72 B4 17 E9 90 00 g`./....r.....
    Status: No Error
    cm> ext-auth plain
    => 84 82 00 00 10 17 6D 1C 2A 87 9E 0A 24 3F 15 83 ......m.*...$?..
    A4 84 10 C0 75 ....u
    (71713 usec)
    <= 90 00 ..
    Status: No Errorh1.
    cm> upload -d "D:\JCIDE_workspace\hello\hello\javacard\hello.cap"
    => 80 E6 02 00 12 05 A0 00 01 00 62 08 A0 00 00 00 ..........b.....
    03 00 00 00 00 00 00 00 ........
    (56499 usec)
    <= 00 90 00 ...
    Status: No Error
    => 80 E8 00 00 FF C4 82 01 A1 01 00 0F DE CA FF ED ................
    01 02 04 00 01 05 A0 00 01 00 62 02 00 1F 00 0F ..........b.....
    00 1F 00 0B 00 15 00 2E 00 0C 00 63 00 17 00 12 ...........c....
    00 00 00 6F 00 02 00 01 00 0A 02 01 00 04 00 15 ...o............
    02 03 01 07 A0 00 00 00 62 01 01 00 01 07 A0 00 ........b.......
    00 00 62 00 01 03 00 0B 01 07 A0 00 01 00 62 03 ..b...........b.> 01 00 08 06 00 0C 00 80 03 00 FF 00 07 01 00 00 ................
    > 00 1C 07 00 63 00 01 10 18 8C 00 00 7A 05 30 8F ....c.......z.0.
    > 00 01 3D 8C 00 02 18 1D 04 41 18 1D 25 8B 00 03 ..=......A..%...
    > 7A 02 21 18 8B 00 04 60 03 7A 19 8B 00 05 2D 1A z.!....`.z....-.
    > 04 25 75 00 10 00 01 00 30 00 09 18 19 8C 00 06 .%u.....0.......
    > 70 08 11 6D 00 8D 00 07 7A 05 21 19 8B 00 05 2D p..m....z.!....-
    > 7B 00 08 03 1A 03 7B 00 08 92 8D 00 09 3B 19 03 {.....{......;..
    7B 00 08 92 8B 00 0A 7A 08 00 17 00 02 00 01 00 {......z........
    01 03 00 0A 48 65 6C 6C 6F 57 6F 72 6C 64 00 00 ....HelloWorld..> 00 00 05 00 2E 00 0B 06 80 03 00 01 00 00 00 06 ................
    > 00 00 01 03 00 .....
    >(1200 msec)
    <= 6A 80 j.
    Status: Wrong data
    jcshell: Error code: 6a80 (Wrong data)
    jcshell: Wrong response APDU: 6A80

    thank you. I use jcdk 2.2.1,jcop31v232 supports jc2.2.1 and gp2.1.1
    And i can not understand this:
    your jcop card is not a javacard v3 card.
    cm> /cap-info -p "D:\JCIDE_workspace\hello\hello\javacard\hello\hello" "D:\JCIDE_workspace\hello\hello\javacard\hello.cap"
    jcshell: Cannot read file <D:\JCIDE_workspace\hello\hello\javacard\hello.cap>: Incomplete CAP file, missing mandatory component: Header.capbut there is Header.cap in hello.cap:
    hello/javacard/Header.cap :
    01 00 13 de ca ff ed 01 02 04 00 01 09 a0 00 01
    00 62 03 01 0c 02

  • Error "Cannot be resolved to a type" on OwnerPIN, APDU, ISO7816

    The error I'm reffering to might clearify the fact that I'm new at Java/javaCard-development.
    To learn how it all works I've downloaded an example and try to understand what happens.
    I opened the source in Eclipse and get errors "Cannot be resolved to a type" on OwnerPIN, ADPU and ISO7816 classes. I have an Import javacard.framework statement and expected these types to be part of this library.
    I guess I'm forgetting something somewhere but couldn't find the soluiton on internet.
    import javacard.framework.*; // import all neccessary packages for java card*
    import java.applet.;
    import java.lang.Object;
    public class classpgdata extends Applet {
    final static byte PROP_CLASS = (byte) 0x80; // Class of the proprietary APDU commands
    static {color:#ff0000}OwnerPIN{color} pin; // the PIN object
    public void process({color:#ff0000}APDU{color} apdu) {
    byte[] cmd_apdu = apdu.getBuffer();
    if (cmd_apdu[{color:#ff0000}ISO7816{color}.OFFSET_CLA] == {color:#ff0000}ISO7816{color}.CLA_ISO7816) {
    //----- it is the ISO/IEC 7816 class
    switch(cmd_apdu[{color:#ff0000}ISO7816{color}.OFFSET_INS]) { // check the instruction byte
    case INS_SELECT: // it is a SELECT FILE instruction
    ...

    Hi,
    What you need to do update your Java build path fr the project in your Eclipse project.
    Project -> Properties then find Java Build Path.
    In the Libraries tab add the {JCDK Home}/lib/javacardframework.jar by clicking the add external JARs button. You may also want to remove the standard Java Runtime (JRE) libraries as you do not build against these.
    If you want to use the JC 2.2.1 CAP file converter, you may also want to ensure that the Eclipse compiler is set to compile as Java 1.3 in the Java Compiler section of the project properties.
    KeesdeVink wrote:
    import javacard.framework.*; // import all neccessary packages for java card
    import java.applet.*;
    import java.lang.Object;
    It also looks like you have added two imports you don't actually want. You only need the javacard.framework.* import.
    Cheers,
    Shane
    Edited by: safarmer on 23/09/2009 08:00

  • OP.error.E6.6A80

    Hi to all. I am novice to java card programming. Presently i am trying to use the sample programs given in Gemplus examples. I am using GSE(GemXpresso Simulator Environment) and gemplus smart cards.
    while trying to install example application i am gettng error as "OP.error.E6.6A80"
    Please help me out.
    Thanks in advance.

    Hello sir the above error(OP.error.E6.6A80) i have solved it with ur help, but now i am trying to generate an RSA key pair and i am getting error as "OP.error.E6.6FB0" and i am using GSE(GemXpresso Simulator Environment), its a GUI, and more over i dont know much about writing APDUs, but the apdus generated while using GSE are,
    *** card inserted : Simulator, ATR = 3B 0D 80 31 80 65 B0 83 01 01 F0 83 00 90 00
    *** change card: Simulator
    Conversion in progress ...
    Converter JC2.1 SUN Converter (version 1.2) Result on card GXPPro-R3 :
    Java Card 2.1.2 Class File Converter (version 1.2)
    Copyright (c) 2001 Sun Microsystems, Inc. All rights reserved.
    parsing E:\prasad\programs\Sample\out\com\mq\smartcard\sample\Sample.class
    converting com.mq.smartcard.sample.Sample
    parsing D:\Gemplus\GemXpresso.rad3\resources\exportfiles\GXPPro-R3\javacard\framework\javacard\framework.exp
    parsing D:\Gemplus\GemXpresso.rad3\resources\exportfiles\GXPPro-R3\javacard\security\javacard\security.exp
    parsing D:\Gemplus\GemXpresso.rad3\resources\exportfiles\GXPPro-R3\java\lang\javacard\lang.exp
    writing E:\prasad\programs\Sample\oncard\GXPPro-R3\com\mq\smartcard\sample\javacard\sample.exp
    writing E:\prasad\programs\Sample\oncard\GXPPro-R3\com\mq\smartcard\sample\javacard\sample.jca
    conversion completed with 0 errors and 0 warnings.
    JC2.1 SUN Converter (version 1.2) process is completed
    JCASM program result on card GXPPro-R3 :
    Java Card 2.1.2 CAP File Builder (version 0.55)
    Copyright (c) 2001 Sun Microsystems, Inc. All rights reserved.
    JCAsm process is completed
    Converter SAP Converter (version 1.0) Result on card GXPPro-R3 :
    SAP file : E:\prasad\programs\Sample\oncard\GXPPro-R3\com\mq\smartcard\sample\javacard\sample.sap done
    SAP Converter (version 1.0) process is completed
    conversion End.
    ======================= Authenticate
    The target file used is D:\Gemplus\GemXpresso.rad3\resources\targets\GXPPro-R3.properties
    CMD: Select
    -> 00 A4 04 00 07 A0 00 00 00 18 43 4D
    <- 90 00
    CMD: Initialize Update
    -> 80 50 0D 00 08 00 00 00 00 00 00 00 00 1C
    <- 43 4D 01 02 03 04 05 06 07 08 0D 01 C3 3A 50 5E 4B 6E A3 2A 08 A9 93 F0 0B 50 23 D5 90 00
    CMD: External Authenticate
    -> 84 82 00 00 10 70 C4 49 A3 E2 18 54 AF F6 25 1B 84 39 2B 63 70
    <- 90 00
    ======================= Upload file into a card
    CMD: Install for load
    -> 80 E6 02 00 15 10 A0 00 00 00 18 FF 00 00 00 00 00 00 00 00 02 05 00 00 00 00 00
    <- 90 00
    7 blocks to load ...
    CMD: Load File
    -> 80 E8 00 00 CC C4 82 04 D0 BA CA CA FE 20 01 17 63 6F 6D 2E 6D 71 2E 73 6D 61 72 74 63 61 72 64 2E 73 61 6D 70 6C 65 10 A0 00 00 00 18 FF 00 00 00 00 00 00 00 00 02 05 24 66 69 6C 65 3A 2F 45 3A 2F 70 72 61 73 61 64 2F 70 72 6F 67 72 61 6D 73 2F 53 61 6D 70 6C 65 2F 6F 75 74 2F 06 53 61 6D 70 6C 65 10 A0 00 00 00 18 FF 00 00 00 00 00 00 00 00 02 06 00 00 04 60 1F 8B 08 00 00 00 00 00 00 00 75 55 5D 4F 1B 47 14 3D 8B 97 6C EC 2C 05 F3 19 C0 7C 26 2D C6 7C 38 84 14 42 A0 B4 D8 38 29 05 1C 8A 0D 09 A1 2D 2C 66 71 17 FC D5 F5 3A 94 54 95 DA A7 48 E9 4B 2A D2 87 AA 0F 69 A3 4A 48 7D 2A 52 0B 55 23 55 79 AB D4 1F D0 9F D2 87
    <- 90 00
    block 1 loaded
    CMD: Load File
    -> 80 E8 00 01 C8 3E 84 9E D9 05 E2 A8 8E AC BD 73 EF 9C 33 F7 CE 9C 19 CF FC F5 FC F7 3F E0 42 1F 3E 74 1D 1D 1D 3D 17 E6 5F 61 FE 11 E6 A1 82 49 05 D3 0A 66 14 CC 2A 88 2A B8 A9 60 4E C1 FB 0A E6 15 C4 14 C4 15 2C 28 58 F4 C0 8D 36 0F 2A D1 EE 41 39 3A 84 D7 E9 C1 59 5C 10 DE 45 61 5E F7 C0 83 37 DC 44 BB 84 F1 0B D3 2D 86 05 3C 50 D1 A3 62 08 41 61 2E 0B F3 A6 8A 88 08 AF 63 40 C5 0D F4 AA 78 17 7D 2A A6 D0 AF E2 16 26 54 DC C6 3B 2A EE 08 B3 8C 4B 2A 3E C0 15 09 ED FE EE 99 4D ED AE 96 D0 CC F5 60 5E 4F 14 4C C3 DA 09 CE 99 C6 5D CD D2 A7 F5 9D 51 09 6D A5 29 85 B5 94 91 70 18 2E 7F 77 CC B6 8B B6 BD 23 41
    <- 90 00
    block 2 loaded
    CMD: Load File
    -> 80 E8 00 02 C8 F6 77 2F 87 24 94 FB 43 31 D1 E9 F3 BF C8 B0 61 6A 69 7D 3B 6B 6E 05 27 E6 26 17 46 05 2C FB 6D 96 E2 5F 0E C5 42 C2 3B 33 66 64 0C 6B 5C 82 C4 24 67 C3 33 13 2B F1 48 2C 4E 62 38 BB AE 4B A8 08 67 33 79 4B CB 58 8B 5A AA C0 D8 13 F9 34 A1 E7 2C 83 BD 12 6A A7 A2 B1 95 1B 91 68 64 7E 22 1E 59 99 8F 4D AC 4C 47 96 24 34 38 DD F1 95 B9 F9 A9 C5 97 90 FA 53 64 21 34 33 15 7E 01 54 CE 18 19 3D 5A 48 AF E9 66 5C 5B 4B B1 50 43 09 21 1C 09 9A 4B 23 73 9A 61 12 3D 17 D3 D2 B9 94 DE 2F 38 9C 6E 2C 5B 30 13 FA 75 43 A4 6C 4D 64 D3 C1 F4 27 C1 7C 5A 33 2D 67 BC CD 0D 3A 43 C8 4E EA 99 E3 4C 12 DC 49 DD
    <- 90 00
    block 3 loaded
    CMD: Load File
    -> 80 E8 00 03 C8 0A 15 36 36 74 D3 06 AC E3 8D 72 00 67 4B 1C 7F 5E D7 F2 D9 0C 35 35 84 52 A9 94 84 1A 51 3C 98 D2 32 C9 E0 A9 5C 2F F5 C6 3F 36 B3 DB C7 EB 7C C5 6E 49 68 2C 85 E4 38 51 4B 42 57 09 2C CC 70 BE 90 B1 8C B4 5E 54 B5 A9 04 73 2A 76 73 F8 EA C0 10 CF 5B 69 B0 68 78 67 09 46 6C 27 6F E9 E9 22 52 C7 FF 37 24 6C EE E4 AC 6C 11 A7 F1 95 9B 56 5C E4 14 E3 C9 38 16 3C 6C 5A 24 72 F7 4A 93 4E FE 1B D4 7F EB 24 5F 45 CE 19 4A DC 41 72 66 36 A1 E7 79 62 D5 9C CD 3F 01 2A F3 7A 4A 4F 58 46 26 79 22 AC 62 89 AD 99 B2 D0 C1 FF BF 1B 80 82 46 5C C5 30 24 5C 63 54 06 99 F1 58 51 EC 62 FC 56 51 5C C6 78 BC 28
    <- 90 00
    block 4 loaded
    CMD: Load File
    -> 80 E8 00 04 C8 96 F8 F1 4A B0 7D 5E 08 76 7B DB 6E 5D CC C5 AB 84 8C 11 46 7F 33 2A 67 9B 09 1C A2 3A 20 FD 8A 26 DF 90 DC 52 E5 FE 11 63 75 B2 DC E3 1B 5C DD 5D DD 1D 92 85 5F 27 1F 07 C2 53 1E C3 EB 4D C2 B7 DA B2 5A 27 AF EF FE 86 56 52 04 B8 07 6F 0B 41 95 60 CB AA E8 17 49 7D C2 34 EF C1 73 CB 9B FD 99 7D FB AC AE 22 81 0D 9C A1 F7 36 EB 47 51 43 5B C5 D9 54 70 FD 5E A2 D5 FC 6A 68 6B D1 8A 3A F4 A0 1E 83 68 E0 8A CE F3 D2 AB C1 34 9A 31 07 1F 96 D0 86 8F D0 CE 5C D5 CC D6 89 24 2E 20 CD 3C 6E BC C7 35 96 D9 6B 1C 61 56 17 DB 3A 9F F2 04 6E EF E6 17 9C C1 53 94 07 9A 7D 87 A8 DD 27 E0 4C A1 9A 34 C0 2F
    <- 90 00
    block 5 loaded
    CMD: Load File
    -> 80 E8 00 05 C8 2E 60 9C 43 80 85 BB 30 CA 1E D9 9E AC C4 52 83 4E 42 69 9C 1C C1 7D D2 73 80 FA D9 C0 01 5A BE 85 BC DF EB 1A AC 7A F8 98 05 32 60 81 5E 79 F0 27 52 F0 B9 78 33 C4 27 2A 04 7E 41 D3 9F 48 06 9E A2 72 A9 DC 2B E3 10 35 54 5C F4 1E A0 2E E0 B4 E7 9F C1 2B 14 73 A2 86 67 A8 A2 74 FB 51 6F B6 AA EF 00 8D B6 A4 7B B8 C8 B8 BD 28 AE 3D 16 D6 91 F8 7B 7A DE CD 2F 6D A1 65 0A B5 C9 DF 6B 76 7B 8F F2 8A F6 01 85 17 ED 23 1E 34 67 F5 9B 68 A2 ED E7 CA 82 5C ED 25 F2 06 28 FB 65 B2 06 F9 5D 61 CF 30 7F 23 7C 7B AE 61 96 BA 2C F3 38 1A 3C 82 9B 3C 54 5B DC 96 6D F2 EE 21 84 CF 10 C6 7D FA 0F 30 89 AF F8
    <- 90 00
    block 6 loaded
    CMD: Load File
    -> 80 E8 80 06 20 5C 7D 4D FF 11 47 7D C3 07 EB 3B 3E 55 3F F0 49 2D 56 35 6C 1F CD D0 7F EA F5 C1 C5 6F 07 00 00 00
    <- 00 90 00
    block 7 loaded
    package loaded in 0 s 578 ms
    ======================= Install
    CMD: InstallApplication
    -> 80 E6 0C 00 39 10 A0 00 00 00 18 FF 00 00 00 00 00 00 00 00 02 05 10 A0 00 00 00 18 FF 00 00 00 00 00 00 00 00 02 06 10 A0 00 00 00 18 FF 00 00 00 00 00 00 00 00 02 06 01 00 02 C9 00 00 00
    <- 6F B0
    *** ??? : OP.error.E6.6FB0
    waiting for ur response.
    Yogesh

  • Error while sending an APDU 6d 00

    Hello,
    I'm testing Javacard and i just want to send vie smartcard io an apdu command 0x80 0x07 0x00 0x00.
    As an response i should get: a simple string back.
    However, it doesen't work. After I selected more or less every ins byt eI'm sending results in an 6d00.
    But if I'm sending it via the APDUTOOL I'm getting the correct answer??
    Must have something to do with the transformation from in to byte. But I don't see where...
    Here is the java code:
    public class SCcommunication {
         private TerminalFactory factory;
         private List<CardTerminal> terminals;
         private CardTerminal terminal;
         private Card card;
         private CardChannel channel;
         private ResponseAPDU response;
         private boolean protocollType;
         private int sendLength;
         private int selectLength; //00 A4 04 00 + LE + aid
         private byte send[], select[];
         private CommandAPDU command;
         //generate a factory, get terminal list, and take the first terminal available (get(0))!
         public SCcommunication(){
              factory= TerminalFactory.getDefault();
              try{
                   terminals = factory.terminals().list();
              catch (CardException ec){
                   ec.printStackTrace();
              terminal = terminals.get(0);
              //if protocolltype=flase then protocoll is T0 else T1
              protocollType=false;
              selectLength=13;
              sendLength=133;
              select= new byte[selectLength];
              select[0]=(byte)(0x00);select[1]=(byte)(0xA4);select[2]=(byte)(0x04);select[3]=(byte)(0x0); select[4]=(byte)(8);
              select[5]=(byte)(0xAB); select[6]=(byte)(0xCD); select[7]=(byte)(0xEF); select[8]=(byte)(0xFE); select[9]=(byte)(0xDC); select[10]=(byte)(0x12);
              select[11]=(byte)(0x34); select[12]=(byte)(0x56); //select[13]=(byte)(0x01); select[14]=(byte)(0x01);
              send= new byte[sendLength];
         public void switchProtocoll(){
              if (!protocollType==true)
                   protocollType=false;
              else
                   protocollType=true;
         public void selectApplet(byte selectAPDU[]){
              try{
              if (protocollType)
                   card = terminal.connect("T=0");
              else
                   card = terminal.connect("T=1");
              channel= card.getBasicChannel();
              response=channel.transmit(new CommandAPDU(select));
              byte respByte[]=response.getBytes();
              System.out.print("The response: ");
              System.out.println();
              for (int i=0;i<respByte.length;i++){     
                   System.out.print(Integer.toHexString(respByte&0xff)+"||");
              System.out.println();
              // the card is not reseted after disconnect, due to false
              card.disconnect(false);
              catch (CardException ec){
                   ec.printStackTrace();
         public void sendToCard(){
              try{
                   if (protocollType)
                        card=terminal.connect("T=0");
                   else
                        card=terminal.connect("T=1");
                   channel= card.getBasicChannel();
                   //response=channel.transmit(new CommandAPDU(send));
                   send[0]=(byte)0x80; send[1]=(byte)0x07; send[2]=(byte)(0x00);send[3]=(byte)(0x00); send[4]=(byte)(128);
                   System.out.println("The response: ");
                   response=channel.transmit(new CommandAPDU(send));
                   byte respByte[]=response.getBytes();
                   for (int i=0;i<respByte.length;i++){
                        System.out.print(Integer.toHexString(respByte[i]&0xff)+"||");
                   System.out.println();
                   System.out.println("Done");
              // the card is not reseted after disconnect, due to false
                        card.disconnect(false);
              catch (CardException ec){
                   ec.printStackTrace();
         public static void main (String args[]){
              SCcommunication sc = new SCcommunication();
              sc.switchProtocoll();
              sc.selectApplet(sc.select);
              sc.sendToCard();
    Here is the corresponending Java Card code:
    public void process(APDU apdu) throws ISOException {
              // this is the text string which will send back from the ICC to the IFD
              final byte[] text = {(byte) 'H', (byte) 'l', (byte) 'l', (byte) ' ',
              (byte) 'o', (byte) 'M', (byte) 'n', (byte) 'a', (byte) 'm', (byte) ' ',
              (byte) 'e', (byte) 'i', (byte) 's', (byte) 'C',
              (byte) 'h', (byte) 'a', (byte) 'r', (byte) 'l', (byte) 'y'};
              // this is the install method which will be called once for installation
              // and registration of the applet
              // this is the method, which will be called from JCRE
              // the cmd_apdu variable is used because of performance reasons
              byte[] cmd_apdu = apdu.getBuffer();
              if (cmd_apdu[0] ==(byte)0x80) {  // it is the rigth class   
              short len_text = (short)text.length; // the len_text variable is used because of performance reasons
              apdu.setOutgoing(); // set transmission to outgoing data
              apdu.setOutgoingLength((short)len_text); // set the number of bytes to send to the IFD
              apdu.sendBytesLong(text, (short)0, (short)len_text);
              } // if
                   else{
                        ISOException.throwIt(ISO7816.SW_NO_ERROR);
              } // process
    Does anybode have any idea?
    Best regards

    Repost with code tgas:
    866393 wrote:
    Hello,
    I'm testing Javacard and i just want to send vie smartcard io an apdu command 0x80 0x07 0x00 0x00.
    As an response i should get: a simple string back.
    However, it doesen't work. After I selected more or less every ins byt eI'm sending results in an 6d00.
    But if I'm sending it via the APDUTOOL I'm getting the correct answer??
    Must have something to do with the transformation from in to byte. But I don't see where...
    Here is the java code:
    public class SCcommunication {
         private TerminalFactory factory;
         private List<CardTerminal> terminals;
         private CardTerminal terminal;
         private Card card;
         private CardChannel channel;
         private ResponseAPDU response;
         private boolean protocollType;
         private int sendLength;
         private int selectLength; //00 A4 04 00 + LE + aid
         private byte send[], select[];
         private CommandAPDU command;
         //generate a factory, get terminal list, and take the first terminal available (get(0))!
         public SCcommunication(){
              factory= TerminalFactory.getDefault();
              try{
                   terminals = factory.terminals().list();
              catch (CardException ec){
                   ec.printStackTrace();
              terminal = terminals.get(0);
              //if protocolltype=flase then protocoll is T0 else T1
              protocollType=false;
              selectLength=13;
              sendLength=133;
              select= new byte[selectLength];
              select[0]=(byte)(0x00);select[1]=(byte)(0xA4);select[2]=(byte)(0x04);select[3]=(byte)(0x0); select[4]=(byte)(8);
              select[5]=(byte)(0xAB); select[6]=(byte)(0xCD); select[7]=(byte)(0xEF); select[8]=(byte)(0xFE); select[9]=(byte)(0xDC); select[10]=(byte)(0x12);
              select[11]=(byte)(0x34); select[12]=(byte)(0x56); //select[13]=(byte)(0x01); select[14]=(byte)(0x01);
              send= new byte[sendLength];
         public void switchProtocoll(){
              if (!protocollType==true)
                   protocollType=false;
              else
                   protocollType=true;
         public void selectApplet(byte selectAPDU[]){
              try{
              if (protocollType)
                   card = terminal.connect("T=0");
              else
                   card = terminal.connect("T=1");
              channel= card.getBasicChannel();
              response=channel.transmit(new CommandAPDU(select));
              byte respByte[]=response.getBytes();
              System.out.print("The response: ");
              System.out.println();
              for (int i=0;i<respByte.length;i++){     
                   System.out.print(Integer.toHexString(respByte&0xff)+"||");
              System.out.println();
              // the card is not reseted after disconnect, due to false
              card.disconnect(false);
              catch (CardException ec){
                   ec.printStackTrace();
         public void sendToCard(){
              try{
                   if (protocollType)
                        card=terminal.connect("T=0");
                   else
                        card=terminal.connect("T=1");
                   channel= card.getBasicChannel();
                   //response=channel.transmit(new CommandAPDU(send));
                   send[0]=(byte)0x80; send[1]=(byte)0x07; send[2]=(byte)(0x00);send[3]=(byte)(0x00); send[4]=(byte)(128);
                   System.out.println("The response: ");
                   response=channel.transmit(new CommandAPDU(send));
                   byte respByte[]=response.getBytes();
                   for (int i=0;i<respByte.length;i++){
                        System.out.print(Integer.toHexString(respByte[i]&0xff)+"||");
                   System.out.println();
                   System.out.println("Done");
              // the card is not reseted after disconnect, due to false
                        card.disconnect(false);
              catch (CardException ec){
                   ec.printStackTrace();
         public static void main (String args[]){
              SCcommunication sc = new SCcommunication();
              sc.switchProtocoll();
              sc.selectApplet(sc.select);
              sc.sendToCard();
    Here is the corresponending Java Card code:
    public void process(APDU apdu) throws ISOException {
              // this is the text string which will send back from the ICC to the IFD
              final byte[] text = {(byte) 'H', (byte) 'l', (byte) 'l', (byte) ' ',
              (byte) 'o', (byte) 'M', (byte) 'n', (byte) 'a', (byte) 'm', (byte) ' ',
              (byte) 'e', (byte) 'i', (byte) 's', (byte) 'C',
              (byte) 'h', (byte) 'a', (byte) 'r', (byte) 'l', (byte) 'y'};
              // this is the install method which will be called once for installation
              // and registration of the applet
              // this is the method, which will be called from JCRE
              // the cmd_apdu variable is used because of performance reasons
              byte[] cmd_apdu = apdu.getBuffer();
              if (cmd_apdu[0] ==(byte)0x80) {  // it is the rigth class   
              short len_text = (short)text.length; // the len_text variable is used because of performance reasons
              apdu.setOutgoing(); // set transmission to outgoing data
              apdu.setOutgoingLength((short)len_text); // set the number of bytes to send to the IFD
              apdu.sendBytesLong(text, (short)0, (short)len_text);
              } // if
                   else{
                        ISOException.throwIt(ISO7816.SW_NO_ERROR);
              } // process
    Does anybode have any idea?
    Best regards

  • Urgent!Plz help me,   Who knows below error?

    cm>  /term "Remote|localhost:56119"
    --Opening terminal
    /card -a a000000003000000 -c com.ibm.jc.CardManagerresetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B F8 13 00 00 81 31 FE 45 4A 43 4F 50 76 32 34    ;.....1.EJCOPv24
        31 B7                                              1.
    IOCTL().
    ATR:
             T = 1                  
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00          ..............
    (552934 nsec)
    <= 6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65    oe...........Y.e
        01 FF 9F 6E 06 47 91 01 17 33 00 73 4A 06 07 2A    ...n.G...3.sJ..*
        86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B    .H..k.`...*.H..k
        02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64    ....c...*.H..k.d
        0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09    ...*.H..k...e...
        2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01    +...Hd...f...+..
        04 01 2A 02 6E 01 02 90 00                         ..*.n....
    Status: No Error
    cm>  set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm>  init-update 255
    => 80 50 00 00 08 CC 20 E2 3A E0 F8 D6 0B 00          .P.... .:.....
    (1457 usec)
    <= 00 00 DE 81 34 18 39 B7 09 70 FF 02 00 00 3D 02    ....4.9..p....=.
        9C 31 C7 89 75 4A BD 96 F6 68 B0 CD 90 00          .1..uJ...h....
    Status: No Error
    cm>  ext-auth plain
    => 84 82 00 00 10 31 E6 FA 16 3D 47 37 FA 2E 01 1B    .....1...=G7....
        A3 33 22 63 EB                                     .3"c.
    (1576 usec)
    <= 90 00                                              ..
    Status: No Error
    cm>  delete -r 01010101010101
    => 80 E4 00 80 09 4F 07 01 01 01 01 01 01 01 00       .....O.........
    (750777 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  upload -c -b 250 "D:\Java workspace\Testtest\bin\Test_GPRegistryEntry_deregisterService\javacard\Test_GPRegistryEntry_deregisterService.cap"
    jcshell: Cannot read <D:\Java workspace\Testtest\bin\Test_GPRegistryEntry_deregisterService\javacard\Test_GPRegistryEntry_deregisterService.cap>: java.io.FileNotFoundException: D:\Java workspace\Testtest\bin\Test_GPRegistryEntry_deregisterService\javacard\Test_GPRegistryEntry_deregisterService.cap (The system cannot find the path specified)
    cm>  install -i 0101010101010101  -q C9#() 01010101010101 0101010101010101
    => 80 E6 0C 00 20 07 01 01 01 01 01 01 01 08 01 01    .... ...........
        01 01 01 01 01 01 08 01 01 01 01 01 01 01 01 01    ................
        00 02 C9 00 00 00                                  ......
    (1233 usec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Unexpected error; aborting executionWho knows above error? its appeared during build the cap file. Who can help me how to build the cap file?

    dear shane,
    I have implemented as you said but it still have an error below. Thanks to review for me and let's me how to fix it.
    thanks very much
    cm>  /term "Remote|localhost:52510"
    --Opening terminal
    /card -a a000000003000000 -c com.ibm.jc.CardManagerresetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B F8 13 00 00 81 31 FE 45 4A 43 4F 50 76 32 34    ;.....1.EJCOPv24
        31 B7                                              1.
    IOCTL().
    ATR:
             T = 1                  
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00          ..............
    (572674 nsec)
    <= 6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65    oe...........Y.e
        01 FF 9F 6E 06 47 91 01 17 33 00 73 4A 06 07 2A    ...n.G...3.sJ..*
        86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B    .H..k.`...*.H..k
        02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64    ....c...*.H..k.d
        0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09    ...*.H..k...e...
        2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01    +...Hd...f...+..
        04 01 2A 02 6E 01 02 90 00                         ..*.n....
    Status: No Error
    cm>  set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm>  init-update 255
    => 80 50 00 00 08 6B F1 B2 30 86 A6 F2 E7 00          .P...k..0.....
    (1609 usec)
    <= 00 00 DE 81 34 18 39 B7 09 70 FF 02 00 00 3D 02    ....4.9..p....=.
        9C 31 C7 89 6A 38 8B BE E2 AE 5E B8 90 00          .1..j8....^...
    Status: No Error
    cm>  ext-auth plain
    => 84 82 00 00 10 4C 85 CA 7F EC 60 8A 55 75 6A 93    .....L....`.Uuj.
        8D 50 B9 70 C4                                     .P.p.
    (1507 usec)
    <= 90 00                                              ..
    Status: No Error
    cm>  delete -r 01020304050505
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 05 00       .....O.........
    (692621 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete -r 01020304050508
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 08 00       .....O.........
    (692620 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete -r 01020304050501
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 01 00       .....O.........
    (686770 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete -r 01020304050507
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 07 00       .....O.........
    (689695 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete -r 01020304050506
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 06 00       .....O.........
    (688232 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete -r 01020304050504
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 04 00       .....O.........
    (691158 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete -r 01020304050502
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 02 00       .....O.........
    (681650 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete -r 01020304050503
    => 80 E4 00 80 09 4F 07 01 02 03 04 05 05 03 00       .....O.........
    (682016 nsec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  upload -c -b 250 "D:\Project\GP Project\FPT SVN\TestApplet\Test_GP_GPRegistryEntry_2.2.1\bin\Test_GPRegistryEntry_getPrivileges\javacard\Test_GPRegistryEntry_getPrivileges.cap"
    => 80 E6 02 00 14 07 01 02 03 04 05 05 03 08 A0 00    ................
        00 00 03 00 00 00 00 00 00 00                      ..........
    (1831 usec)
    <= 00 90 00                                           ...
    Status: No Error
    Start loading Header.cap (59 byte)
    => 80 E8 00 00 3B C4 82 02 A5 01 00 34 DE CA FF ED    ....;......4....
        02 02 04 00 01 07 01 02 03 04 05 05 03 22 54 65    ............."Te
        73 74 5F 47 50 52 65 67 69 73 74 72 79 45 6E 74    st_GPRegistryEnt
        72 79 5F 67 65 74 50 72 69 76 69 6C 65 67 65 73    ry_getPrivileges
        00                                                 .
    (1427 usec)
    <= 00 90 00                                           ...
    Status: No Error
    Header.cap loaded (59 byte)
    Start loading Directory.cap (36 byte)
    => 80 E8 00 01 24 02 00 21 00 34 00 21 00 0C 00 1E    ....$..!.4.!....
        00 4A 00 14 01 7D 00 0A 00 26 00 00 00 AC 07 DE    .J...}...&......
        00 00 00 00 00 00 03 01 00 00                      ..........
    (1278 usec)
    <= 00 90 00                                           ...
    Status: No Error
    Directory.cap loaded (36 byte)
    Start loading Import.cap (33 byte)
    => 80 E8 00 02 21 04 00 1E 03 04 01 07 A0 00 00 00    ....!...........
        62 01 01 05 01 06 A0 00 00 01 51 00 00 01 07 A0    b.........Q.....
        00 00 00 62 00 01 00                               ...b...
    (5082 usec)
    <= 6A 80                                              j.
    Status: Wrong data
    jcshell: Error code: 6a80 (Wrong data)
    jcshell: Wrong response APDU: 6A80
    Unexpected error; aborting execution

  • Install error -look at the code. plz help

    I have the simple applet that I'm able to compile and load on to a JCOP10 cartd. When I try to install the applet so that I can start interacting with it, I get the following error. How do I go beyond this point? I'll appreciate your help.
    JCOP shell
    Load report:
    747 bytes loaded in 0.0 seconds
    effective code size on card:
    + package AID 6
    + applet AIDs 13
    + classes 21
    + methods 470
    + statics 0
    + exports 0
    overall 510 bytes
         end
         /set-var J 0
         while ${J} < ${PKG_${I}_APP_COUNT}
              install -i ${PKG_${I}_APP_${J}_INST_AID} -q C9#(${PKG_${I}_APP_${J}_INST_DATA}) ${PKG_${I}_AID} ${PKG_${I}_APP_${J}_AID}
    => 80 E6 0C 00 24 06 11 11 11 11 11 11 06 22 22 22 ....$........"""
    22 22 22 06 22 22 22 22 22 33 01 00 0B C9 09 23 """."""""3.....#
    42 38 47 36 74 63 76 73 00 00 B8G6tcvs..
    (0 msec)
    <= 6A 80 j.
    Status: Wrong data
    Error code: 6a80 (Wrong data)
    Offending APDU: 6A80
    Here is the code.
    * Package: myWallet
    * Filename: MyWallet.java
    * Class: MyWallet
    * Date: Jan 23, 2004 2:01:58 PM
    package myWallet;
    import javacard.framework.*;
    //import javacardx.framework.*;
    public class MyWallet extends Applet
    /* constants declaration */
    // code of CLA byte in the command APDU header
    final static byte Wallet_CLA =(byte)0x80;
    // codes of INS byte in the command APDU header
    final static byte VERIFY = (byte) 0x20;
    final static byte CREDIT = (byte) 0x30;
    final static byte DEBIT = (byte) 0x40;
    final static byte GET_BALANCE = (byte) 0x50;
    // maximum balance
    final static short MAX_BALANCE = (byte)0x7FFF;
    // maximum transaction amount
    final static byte MAX_TRANSACTION_AMOUNT =(byte)0x007F;
    // maximum number of incorrect tries before the
    // PIN is blocked
    final static byte PIN_TRY_LIMIT =(byte)0x03;
    // maximum size PIN
    final static byte MAX_PIN_SIZE =(byte)0x08;
    // signal that the PIN verification failed
    final static short SW_VERIFICATION_FAILED = 0x6300;
    // signal the the PIN validation is required
    // for a credit or a debit transaction
    final static short SW_PIN_VERIFICATION_REQUIRED =     0x6301;
    // signal invalid transaction amount
    // amount > MAX_TRANSACTION_AMOUNT or amount < 0
    final static short SW_INVALID_TRANSACTION_AMOUNT = 0x6A83;
    // signal that the balance exceed the maximum
    final static short SW_EXCEED_MAXIMUM_BALANCE = 0x6A84;
    // signal the the balance becomes negative
    final static short SW_NEGATIVE_BALANCE = 0x6A85;
    /* instance variables declaration */
    OwnerPIN pin;
    short balance;
    private MyWallet (byte[] bArray,short bOffset,byte bLength)
         // It is good programming practice to allocate
         // all the memory that an applet needs during
         // its lifetime inside the constructor
         pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);
         byte iLen = bArray[bOffset]; // aid length
         bOffset = (short) (bOffset+iLen+1);
         byte cLen = bArray[bOffset]; // info length
         bOffset = (short) (bOffset+cLen+1);
         byte aLen = bArray[bOffset]; // applet data length
         // The installation parameters contain the PIN
         // initialization value
         pin.update(bArray, (short)(bOffset+1), aLen);
    register();
    } // end of the constructor
    public static void install(byte[] bArray, short bOffset, byte bLength){
         // create a Wallet applet instance
         MyWallet me = new MyWallet(bArray, bOffset, bLength);
    me.register(bArray, bOffset, bLength);
    } // end of install method
    public boolean select()
         // The applet declines to be selected
         // if the pin is blocked.
         if ( pin.getTriesRemaining() == 0 )
         return false;
         return true;
    }// end of select method
    public void deselect() {
         // reset the pin value
         pin.reset();
    public void process(APDU apdu) {
         // APDU object carries a byte array (buffer) to
         // transfer incoming and outgoing APDU header
         // and data bytes between card and CAD
         // At this point, only the first header bytes
         // [CLA, INS, P1, P2, P3] are available in
         // the APDU buffer.
         // The interface javacard.framework.ISO7816
         // declares constants to denote the offset of
         // these bytes in the APDU buffer
         byte[] buffer = apdu.getBuffer();
         // check SELECT APDU command
         buffer[ISO7816.OFFSET_CLA] = (byte)(buffer[ISO7816.OFFSET_CLA] & (byte)0xFC);
         if ((buffer[ISO7816.OFFSET_CLA] == 0) &&
         (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) )
         return;
         // verify the reset of commands have the
         // correct CLA byte, which specifies the
         // command structure
         if (buffer[ISO7816.OFFSET_CLA] != Wallet_CLA)
         ISOException.throwIt
    (ISO7816.SW_CLA_NOT_SUPPORTED);
         switch (buffer[ISO7816.OFFSET_INS]) {
         case GET_BALANCE: getBalance(apdu);
                                  return;
         case DEBIT: debit(apdu);
                                  return;
         case CREDIT: credit(apdu);
                                  return;
         case VERIFY: verify(apdu);
                                  return;
         default: ISOException.throwIt (ISO7816.SW_INS_NOT_SUPPORTED);
    } // end of process method
    private void credit(APDU apdu)
    // access authentication
    if ( ! pin.isValidated() )
    ISOException.throwIt(
              SW_PIN_VERIFICATION_REQUIRED);
         byte[] buffer = apdu.getBuffer();
         // Lc byte denotes the number of bytes in the
         // data field of the command APDU
         byte numBytes = buffer[ISO7816.OFFSET_LC];
         // indicate that this APDU has incoming data
         // and receive data starting from the offset
         // ISO7816.OFFSET_CDATA following the 5 header
         // bytes.
         byte byteRead =
                   (byte)(apdu.setIncomingAndReceive());
         // it is an error if the number of data bytes
         // read does not match the number in Lc byte
         if ( ( numBytes != 1 ) || (byteRead != 1) )
         ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
         // get the credit amount
         byte creditAmount = buffer[ISO7816.OFFSET_CDATA];
         // check the credit amount
         if ( ( creditAmount > MAX_TRANSACTION_AMOUNT)
              || ( creditAmount < 0 ) )
              ISOException.throwIt
                        (SW_INVALID_TRANSACTION_AMOUNT);
         // check the new balance
         if ( (short)( balance + creditAmount) > MAX_BALANCE )
         ISOException.throwIt
                             (SW_EXCEED_MAXIMUM_BALANCE);
         // credit the amount
         balance = (short)(balance + creditAmount);
    } // end of deposit method
    private void debit(APDU apdu)
         // access authentication
         if ( ! pin.isValidated() )
         ISOException.throwIt
    (SW_PIN_VERIFICATION_REQUIRED);
         byte[] buffer = apdu.getBuffer();
         byte numBytes =
                   (byte)(buffer[ISO7816.OFFSET_LC]);
         byte byteRead =
                   (byte)(apdu.setIncomingAndReceive());
         if ( ( numBytes != 1 ) || (byteRead != 1) )
         ISOException.throwIt
                                  (ISO7816.SW_WRONG_LENGTH);
         // get debit amount
         byte debitAmount =
                             buffer[ISO7816.OFFSET_CDATA];
         // check debit amount
         if ( ( debitAmount > MAX_TRANSACTION_AMOUNT)
              || ( debitAmount < 0 ) )
         ISOException.throwIt
                        (SW_INVALID_TRANSACTION_AMOUNT);
         // check the new balance
         if ( (short)( balance - debitAmount ) < (short)0 )
              ISOException.throwIt(SW_NEGATIVE_BALANCE);
         balance = (short) (balance - debitAmount);
    } // end of debit method
    private void getBalance(APDU apdu) {
         byte[] buffer = apdu.getBuffer();
         // inform system that the applet has finished
         // processing the command and the system should
         // now prepare to construct a response APDU
         // which contains data field
         short le = apdu.setOutgoing();
         if ( le < 2 )
         ISOException.throwIt
                             (ISO7816.SW_WRONG_LENGTH);
         //informs the CAD the actual number of bytes
         //returned
         apdu.setOutgoingLength((byte)2);
         // move the balance data into the APDU buffer
         // starting at the offset 0
         buffer[0] = (byte)(balance >> 8);
         buffer[1] = (byte)(balance & 0xFF);
         // send the 2-byte balance at the offset
         // 0 in the apdu buffer
         apdu.sendBytes((short)0, (short)2);
    } // end of getBalance method
    private void verify(APDU apdu) {
         byte[] buffer = apdu.getBuffer();
         // retrieve the PIN data for validation.
    byte byteRead =(byte)(apdu.setIncomingAndReceive());
    // check pin
         // the PIN data is read into the APDU buffer
    // at the offset ISO7816.OFFSET_CDATA
    // the PIN data length = byteRead
    if ( pin.check(buffer, ISO7816.OFFSET_CDATA,byteRead) == false )
         ISOException.throwIt(SW_VERIFICATION_FAILED);
    } // end of validate method
    } // end of class Wallet

    How do I set a breakpoint in my install method in order to identify the error?
    I've tried changing my install method and making it look exactly like the sample wallet applications accompanying the javacard kit, but I'm still getting the same error? here else could be the possible source of the error?
    Thomas

  • Java card cap file install error in jcop tools

    When i try to run java card applet in real java card it gives this error.i used jcop tools and java version 1.5  and eclipse 3.2.when i run the applet in simulater it works fine.i saw some document it says allocate memory for the installation process.i don't know how to do that.
    /term "winscard:4|SCM Microsystems Inc. SCL010 Contactless Reader 0"
    --Opening terminal
    >  /card -a a000000003000000 -c com.ibm.jc.CardManager
    resetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B 8A 80 01 4A 43 4F 50 33 31 56 32 33 32 7A       ;...JCOP31V232z
    ATR: T=0, T=1, Hist="JCOP31V232"
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00          ..............
    (23807 usec)
    <= 6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65    oe...........Y.e
        01 FF 9F 6E 06 47 91 73 51 2E 00 73 4A 06 07 2A    ...n.G.sQ..sJ..*
        86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B    .H..k.`...*.H..k
        02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64    ....c...*.H..k.d
        0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09    ...*.H..k...e...
        2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01    +...Hd...f...+..
        04 01 2A 02 6E 01 02 90 00                         ..*.n....
    Status: No Error
    cm>  set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm>  init-update 255
    => 80 50 00 00 08 AC B1 90 01 BF 2D 24 A0 00          .P........-$..
    (49906 usec)
    <= 00 00 91 18 01 39 93 95 05 59 FF 02 00 2C BE 39    .....9...Y...,.9
        5E A5 07 55 87 B8 C3 A8 A6 93 66 2B 90 00          ^..U......f+..
    Status: No Error
    cm>  ext-auth plain
    => 84 82 00 00 10 0C AE 50 3E C8 7E 1D 92 29 E2 59    .......P>.~..).Y
        08 D9 DA 02 16                                     .....
    (57276 usec)
    <= 90 00                                              ..
    Status: No Error
    cm>  delete 060504030201
    => 80 E4 00 00 08 4F 06 06 05 04 03 02 01 00          .....O........
    (40041 usec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  delete 010203040506
    => 80 E4 00 00 08 4F 06 01 02 03 04 05 06 00          .....O........
    (17392 usec)
    <= 6A 88                                              j.
    Status: Reference data not found
    jcshell: Error code: 6a88 (Reference data not found)
    jcshell: Wrong response APDU: 6A88
    Ignoring expected error
    cm>  upload -d -b 250 "Cap File location"
    => 80 E6 02 00 13 06 01 02 03 04 05 06 08 A0 00 00    ................
        00 03 00 00 00 00 00 00 00                         .........
    (32303 usec)
    <= 00 90 00                                           ...
    Status: No Error
    => 80 E8 00 00 FA C4 81 F2 01 00 23 DE CA FF ED 02    ..........#.....
        02 04 00 01 06 01 02 03 04 05 06 12 68 6D 73 2F    ............hms/
        6A 61 76 61 63 61 72 64 2F 68 65 6C 6C 6F 02 00    javacard/hello..
        21 00 23 00 21 00 0A 00 0B 00 1E 00 0E 00 3D 00    !.#.!.........=.
        0A 00 0B 00 00 00 4D 01 BE 00 00 00 00 00 00 01    ......M.........
        01 00 04 00 0B 01 02 01 07 A0 00 00 00 62 01 01    .............b..
        03 00 0A 01 06 06 05 04 03 02 01 00 08 06 00 0E    ................
        00 00 00 80 03 00 FF 00 07 01 00 00 00 1C 07 00    ................
        3D 00 01 10 18 8C 00 05 7A 05 30 8F 00 00 3D 8C    =.......z.0...=.
        00 01 18 1D 04 41 18 1D 25 8B 00 02 7A 02 21 18    .....A..%...z.!.
        8B 00 03 60 03 7A 19 8B 00 04 2D 1A 04 25 73 00    ...`.z....-..%s.
        09 00 00 00 00 00 0F 11 6D 00 8D 00 06 7A 08 00    ........m....z..
        0A 00 00 00 00 00 00 00 00 00 00 05 00 1E 00 07    ................
        01 00 02 00 06 00 00 01 03 80 03 02 03 80 03 03    ................
        03 80 0A 01 06 80 03 00 06 80 07 01 09 00 0B 00    ................
        00 00 07 05 06 04 0A 07 07 13 0B 00 4D 01 00 00    ............M...
    (764519 usec)
    <= 6A 80                                              j.
    Status: Wrong data
    jcshell: Error code: 6a80 (Wrong data)
    jcshell: Wrong response APDU: 6A80
    Unexpected error; aborting execution

    Thanks ReNa
    i am using nxp jcop 31 contact-less card.and it will support for java card 2.2.1 and global-platform card specification 2.1.1 .so i am using nxp jcop training 2007 tools and it has java card 2.2.1 and global-platform card specification 2.1.1.Inside my project there are three jar files these are jc221.jar and gp211.jar and bio10.jar
    i will appreciate your help
    Thanks

Maybe you are looking for

  • Why does Birthday without Year in iContacts Display Age in iCalendar?

    I enter Birthdays - without year - in iCloud contacts. Then PC's (Windows 7) iCloud calendar displays "Jane Doe's 5th"  or "Jane Doe's 11th" birthday. Huh? How/Why does this happen and how can it be eliminated?

  • Save Exceptions Limitation

    Hello Gurus, I have a problem with the Save Exceptions. I am using database 11g. When I am doing bulk insert I would like to insert the error records into a new table. But when I am inserting the error records I am getting the error "error:- ORA-0098

  • Usage of RBS

    I used database backup and do the restoration on a testing machine and I can observe the rbs tablespace's space was used up after applying the archivelogs to the accident time. However, there are no txn information inside (that's expected).My questio

  • Seeking Professional advice for learning new technology

    Hi Friends/Professional, I am working as ABAP Consultant, i would like to learn new technology in sap, i am seeking advice please help me. As a abaper shall i select BW or XI or ABAP HR which is best acording to industry india/us market. i am not int

  • Middle click not opening new tab on Mac version 32.0.2

    Middle click stopped opening in a new tab on Mac version 32.0.1 or 32.0.2. Disabled TabMixPlus, no change. browser.tabs.opentabfor.middleclick is set to default true.