Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

How to catch the reason of error 6F00

JavaCard Applet Development Related Questions and Answers.
Valks
Posts: 16
Joined: Wed Oct 12, 2016 11:45 pm
Points :176
Contact:

How to catch the reason of error 6F00

Post by Valks » Tue Aug 22, 2017 11:44 pm

When I debugged my applet, it always returned error status word 0x6F00. Is it possible to catch the reason of this error ?

Code: Select all

        OwnerPIN mypin;

        private FirstApp(byte bArray[], short bOffset, byte bLength){

                backSomething = new byte[BS_LENGTH];

                mypin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);

                byte pin[]={0x00,0x00,0x00,0x00};
                mypin.update (pin, (short) 0, (byte) 0x04);
               
                register();
        }

        private void verifypin(APDU apdu){

                byte[] buffer = apdu.getBuffer();
                byte byteRead = (byte) apdu.setIncomingAndReceive();
                if ( mypin.check ( buffer, ISO7816.OFFSET_CDATA, byteRead ) == false )
                        ISOException.throwIt(SW_VERIFICATION_FAILED);

        }

User avatar
BrooksIQ
Posts: 18
Joined: Mon Jun 15, 2015 11:12 pm
Points :182
Contact:

Re: How to catch the reason of error 6F00

Post by BrooksIQ » Wed Aug 23, 2017 6:24 am

Your problem may be caused by this line:

byte byteRead = (byte) apdu.setIncomingAndReceive();
Your mind will answer most questions if you learn to relax and wait for the answer---William S. Burroughs

Valks
Posts: 16
Joined: Wed Oct 12, 2016 11:45 pm
Points :176
Contact:

Re: How to catch the reason of error 6F00

Post by Valks » Wed Aug 23, 2017 6:48 am

BrooksIQ wrote:Your problem may be caused by this line:

byte byteRead = (byte) apdu.setIncomingAndReceive();


Thank you so much for your pointer. Now I can check my pin successfully.But I still have another question.

I wrote a simple method to update the PIN. I can update the pin, but when I call the verify method, the response APDU tell me that I have a wrong pin. How can I fix this problem?

Code: Select all

                byte[] buffer = apdu.getBuffer();

                if ( buffer[ISO7816.OFFSET_LC] >  MAX_PIN_SIZE)
                        ISOException.throwIt(SW_PIN_EX);

                mypin.update(buffer, buffer[ISO7816.OFFSET_CDATA], buffer[ISO7816.OFFSET_LC]);

User avatar
BrooksIQ
Posts: 18
Joined: Mon Jun 15, 2015 11:12 pm
Points :182
Contact:

Re: How to catch the reason of error 6F00

Post by BrooksIQ » Wed Aug 23, 2017 10:22 pm

0x6F00 is usually returned by the card when an exception is not caught.
Could you show us your process method ?
Your mind will answer most questions if you learn to relax and wait for the answer---William S. Burroughs

User avatar
BrooksIQ
Posts: 18
Joined: Mon Jun 15, 2015 11:12 pm
Points :182
Contact:

Re: How to catch the reason of error 6F00

Post by BrooksIQ » Wed Aug 23, 2017 10:24 pm

You may also try to add a try/catch clause to confirm which exception is thrown.
.
Your mind will answer most questions if you learn to relax and wait for the answer---William S. Burroughs

Valks
Posts: 16
Joined: Wed Oct 12, 2016 11:45 pm
Points :176
Contact:

Re: How to catch the reason of error 6F00

Post by Valks » Thu Aug 24, 2017 2:59 am

Process method

Code: Select all

public void process(APDU apdu){

                byte buffer[] = apdu.getBuffer() ;
                byte byesRead = (byte) apdu.setIncomingAndReceive();

                if ( ( buffer[ISO7816.OFFSET_CLA] == 0) &&
                        (buffer[ISO7816.OFFSET_INS] == (byte) 0xA4)) return;


                switch ( buffer[ISO7816.OFFSET_INS] ){

                case GET_INS: get_ins(apdu); break;
                case VER_PIN: verifypin(apdu); break;
                case SET_PIN: mysetpin(apdu); break;
                default: ISOException.throwIt(ISO7816.SW_WRONG_DATA);

                }
        }


>> CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0f, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, 03, 00, 00, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01
<< 90 00

>> CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, Le: 00
<< 90 00

>> CLA: b0, INS: 20, P1: 10, P2: 00, Lc: 03, 00, 00, 00, Le: 00 // Verify PIN
<< 90 00

>> CLA: b0, INS: 30, P1: 00, P2: 00, Lc: 03, 01, 02, 03, Le: 00
<< 90 00

>> CLA: b0, INS: 20, P1: 10, P2: 00, Lc: 03, 01, 02, 03, Le: 00
<< 63 00

>> CLA: b0, INS: 15, P1: 20, P2: 30, Lc: 02, 00, 00, Le: 00
<< 65 00

User avatar
BrooksIQ
Posts: 18
Joined: Mon Jun 15, 2015 11:12 pm
Points :182
Contact:

Re: How to catch the reason of error 6F00

Post by BrooksIQ » Thu Aug 24, 2017 3:16 am

mypin.update(buffer, buffer[ISO7816.OFFSET_CDATA], buffer[ISO7816.OFFSET_LC]);

The second parameter of OwnerPIN.update() is the starting offset of your pin in the given array.
In your example command, your are using the content of the APDU buffer at offset 5. This may be the problem.
Your mind will answer most questions if you learn to relax and wait for the answer---William S. Burroughs

Valks
Posts: 16
Joined: Wed Oct 12, 2016 11:45 pm
Points :176
Contact:

Re: How to catch the reason of error 6F00

Post by Valks » Thu Aug 24, 2017 3:50 am

Thank you very much for your help, BrooksIQ. It saved all my day. Much appreciated.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 59 guests

JavaCard OS : Disclaimer