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.

NITIALIZE UPDATE and EXTERNAL AUTHENTICATE GlobalPlatform

JavaCard Applet Development Related Questions and Answers.
callmeuvn
Posts: 8
Joined: Tue Apr 14, 2020 8:59 am
Points :248
Contact:

NITIALIZE UPDATE and EXTERNAL AUTHENTICATE GlobalPlatform

Post by callmeuvn » Fri May 29, 2020 12:47 am

I have trouble when using INITIALIZE UPDATE and EXTERNAL AUTHENTICATE function from Global Platform API library in my JavaCard Applet.

Without using the variable SecureChannel mySecureChannel, the installation of the applet into card is NOT successful, returning SW 6A80. But when I remove this variable, the installation is successful.

The library using is 0rg.globalplatform version 1.6; JCDK is 3.0.5 from Oracle site; Card support SCP02 and GP version is 2.1

Could you please share how to fix this error?.

Here is code:

package AuthenTest;

import javacard.framework.*;
import org.globalplatform.GPSystem;
import org.globalplatform.SecureChannel;


public class AuthenTest extends Applet {

final static byte INIITCLA = (byte) 0x80;
final static byte UPDATECLA = (byte) 0x80;

final static byte INITIALIZE_UPDATE = (byte) 0x50;
final static byte EXTERNAL_AUTHENTICATE = (byte) 0x82;

private SecureChannel mySecureChannel;


public static void install(byte[] bArray, short bOffset, byte bLength) {
new AuthenTest(bArray, bOffset, bLength);
}


private AuthenTest(byte[] bArray, short bOffset, byte bLength) {
register();
}

public void process(APDU apdu) {

byte[] buffer = apdu.getBuffer();
short length;

if (selectingApplet()) {
if((short)(buffer[ISO7816.OFFSET_CLA] & 0xFF) != 0x00)
ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
length = apdu.setIncomingAndReceive();
if((short)(buffer[ISO7816.OFFSET_LC] & 0xFF) != (byte) length)
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);

return;
}
if ((buffer[ISO7816.OFFSET_CLA] != (byte) INIITCLA) && (buffer[ISO7816.OFFSET_CLA] != (byte) UPDATECLA))
ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);

switch (buffer[ISO7816.OFFSET_INS]) {

case INITIALIZE_UPDATE:
mySecureChannel = GPSystem.getSecureChannel();
length = mySecureChannel.processSecurity(apdu);
apdu.setOutgoingAndSend(ISO7816.OFFSET_CDATA, length);
return;

case EXTERNAL_AUTHENTICATE:
/* if (mySecureChannel == null) {
ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);
}
mySecureChannel.processSecurity(apdu);
return;
*/
default:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}

}
}

Who is online

Users browsing this forum: No registered users and 51 guests

JavaCard OS : Disclaimer