JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

6C 0B - Unknown Error ( DEBUG )

JavaCard Applet Development Related Questions and Answers.
teixeira
Posts: 13
Joined: Tue Dec 06, 2016 10:53 am
Points :130
Location: Brazil
Contact:

6C 0B - Unknown Error ( DEBUG )

Post by teixeira » Thu Dec 08, 2016 3:29 pm

Hello everyone,

I am having the following error when debugging: 6C 0B

But the INS is: (byte) 0x00;

I understand that the APDU is:
CLS | INS | P1 | P2 | LC | LE

CLS: 80
INS: 00
P1: 00
P2: 00


// debug JCIDE IDE :

>> /select 010203040506070809070707 <-- AID
>> 00 A4 04 00 0C 01 02 03 04 05 06 07 08 09 07 07 07 00
<< 90 00 <-- OK


>> /send 80000000
>> 80 00 00 00
<< 6C 0B Unknown Error <-- error




Here is my source ...

package br.com.helloworld;

import javacard.framework.*;



public class HelloWorldJC extends javacard.framework.Applet {

// CLA Byte

final static byte HELLO_CLA = (byte) 0x80;
private static final byte[] helloWorld = { (byte) 'H', (byte) 'e',

(byte) 'l', (byte) 'l', (byte) 'o', (byte) ' ', (byte) 'W',

(byte) 'o', (byte) 'r', (byte) 'l', (byte) 'd', };

private static final byte INS_HELLO = (byte) 0x00;



public static void install(byte[] bArray, short bOffset, byte bLength) {

(new HelloWorldJC()).register(

bArray,

(short) (bOffset + 1),

bArray[bOffset]);

}



public void process(APDU apdu) {

byte[] buffer = apdu.getBuffer();

if ((buffer[ISO7816.OFFSET_CLA] == 0)

&& (buffer[ISO7816.OFFSET_INS] == (byte) (0xA4)))

return;



if (buffer[ISO7816.OFFSET_CLA] != HELLO_CLA)

ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);



switch (buffer[ISO7816.OFFSET_INS]) {

case INS_HELLO :

getHello(apdu);

return;

default :

ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);

}

}


private void getHello(APDU apdu) {


short le = apdu.setOutgoing();
short totalBytes = (short) helloWorld.length;
apdu.setOutgoingLength(totalBytes);

apdu.sendBytesLong(helloWorld, (short) 0, (short) helloWorld.length);

}

}

teixeira
Posts: 13
Joined: Tue Dec 06, 2016 10:53 am
Points :130
Location: Brazil
Contact:

Re: 6C 0B - Unknown Error ( DEBUG )

Post by teixeira » Thu Dec 08, 2016 11:00 pm

Hi,

I Solved the problem :


short readCount = apdu.setIncomingAndReceive();
[b]
Util.arrayCopyNonAtomic(helloWorld,(byte)0,buffer,ISO7816.OFFSET_CDATA,(short)helloWorld.length);
[/b]
apdu.setOutgoingAndSend(ISO7816.OFFSET_CDATA,(short)helloWorld.length);

break;


Thanks !

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: 6C 0B - Unknown Error ( DEBUG )

Post by UNKNwYSHSA » Thu Dec 08, 2016 11:32 pm

Send the command with LE as 0x0B;

Code: Select all

/send 800000000B


SW = 0x6Cxx
Means that the command shall be sent with LE = xx.
sense and simplicity

teixeira
Posts: 13
Joined: Tue Dec 06, 2016 10:53 am
Points :130
Location: Brazil
Contact:

Re: 6C 0B - Unknown Error ( DEBUG )

Post by teixeira » Fri Dec 09, 2016 10:51 am

Hi, UNKNwYSHSA

Thanks !

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: 6C 0B - Unknown Error ( DEBUG )

Post by UNKNwYSHSA » Sat Dec 10, 2016 5:36 am

:roll:
sense and simplicity

tay00000
Posts: 161
Joined: Tue Sep 27, 2016 10:58 am
Points :2324
Contact:

Re: 6C 0B - Unknown Error ( DEBUG )

Post by tay00000 » Sat Dec 10, 2016 11:19 pm

Please use the Code tag for your APDU request/response and codes to make it easier for forum members to read.

Thanks.

teixeira
Posts: 13
Joined: Tue Dec 06, 2016 10:53 am
Points :130
Location: Brazil
Contact:

Re: 6C 0B - Unknown Error ( DEBUG )

Post by teixeira » Mon Dec 12, 2016 8:14 am

Hi,

Ok, sorry !

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 9 guests

JavaCard OS : Disclaimer