Here there is a simple test applet that I've wrote and installed on my Javacard as "default selected applet". As you see, it throw 0x6a6a
on reception of any APDU command with INS = 0X00
:
package testPack;
import javacard.framework.*;
public class TestApplet extends Applet implements MultiSelectable
{
public boolean select(boolean appInstAlreadySelected) {
return true;
}
public void deselect(boolean appInstStillSelected) {
}
public static void install(byte[] bArray, short bOffset, byte bLength)
{
new TestApplet().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}
public void process(APDU apdu)
{
if (selectingApplet())
{
return;
}
byte[] buf = apdu.getBuffer();
switch (buf[ISO7816.OFFSET_INS])
{
case (byte)0x00:
ISOException.throwIt((short)0x6A6A);
break;
default:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}
}
As you see below, after a card warm reset, I sent some APDU commands to the card:
Reset successful.
Send: 00 00 00 00 01
Recv: 6A 6A
Send: 10 00 00 00 01
Recv: 6A 6A
Send: 80 00 00 00 01
Recv: 6A 6A
Send: E0 00 00 00 01
Recv: 68 81 <====
Question 1: Why I receive 0x6881
for CLA = 0XE0
?
And below you can see another sequence of commands after a card warm reset:
Reset successful.
Send: 00 00 00 00 00
Recv: 6A 6A
Send: 01 00 00 00 00 // Try to send commands with logical channel 1 instead of 0
Recv: 68 81 //Error because the channel is not open.
Send: 00 70 00 01 00 // Opening the channel with MANAGE CHANNEL APDU command
Recv: 90 00
Send: 01 00 00 00 00
Recv: 6A 6A
Send: 11 00 00 00 00
Recv: 6A 6A
Send: 81 00 00 00 00
Recv: 6A 6A
Send: E1 00 00 00 00
Recv: 68 81 <== Same Error as before!
Question 2: Is there any way to make all logical channels open by default? I mean is there any way to delete the MANAGE CHANNEL APDU command from the sequence?
Question 3: Why CLA = 0xE1
returns 0x6881?
Question 4: My applet is the default selected applet. So I except my applet to receive all APDU commands other than SELECT APDU command instead of Card Manager (Security Domain). So does MANAGE CHANNEL APDU command work? I mean, Why Card Manager receive that command instead of my applet? Which commands will be parsed by Card Manager instead of my applet?