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

Unable to change historical bytes JCOP4 P71 J3R200 with default privilege

Card Products

Moderator: horse dream

feature
Posts: 4
Joined: Thu May 06, 2021 7:52 am
Points :80
Contact:

Unable to change historical bytes JCOP4 P71 J3R200 with default privilege

Post by feature » Sun Jul 03, 2022 5:40 am

I've created a simple app which should be able to modify historical bytes.
Compiled it with java_card_kit-305u3 and GlobalPlatform 2.1.1
Successfully installed it using GlobalPlafromPro using the command

Code: Select all

/gp --install miniAppletPkg.cap -default
(after deleting the applet that came with the card and was set to default),
and verified with

Code: Select all

gp --list
that indeed my applet is installed and has the CardReset privilege.

When I send an apdu to the card, it should just take the data of that apdu and set it as the historical bytes, I'm also checking the return value and throw if it is False (meaning that the function had failed setting the bytes).

It calls the function, and returns fine - but the historical bytes are unchanged.
I've also tried physically removing the card and reconnecting, but it didn't change anything.

Here's my code:

Code: Select all

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


public final class miniApplet extends Applet 
{
	public static void install(byte[] bArray, short bOffset, byte bLength)
	{
		new miniApplet(); 
	}
	
	public miniApplet() {
		register();
	}
	
	public void process(APDU apdu)
	{
		if (selectingApplet())
		{
			return;
		}

		byte[] buf = apdu.getBuffer();
		if (buf[ISO7816.OFFSET_CLA] != 0xA0)
			ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
		if (buf[ISO7816.OFFSET_INS] != 0x01)
			ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
		if (!GPSystem.setATRHistBytes(buf, ISO7816.OFFSET_CDATA, buf[ISO7816.OFFSET_LC]))
			ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED);
	}
}	
Any ideas?

feature
Posts: 4
Joined: Thu May 06, 2021 7:52 am
Points :80
Contact:

Re: Unable to change historical bytes JCOP4 P71 J3R200 with default privilege

Post by feature » Mon Jul 04, 2022 6:33 am

Could it be because I'm using GlobalPlatform 2.1.1, and the card only supports GlobalPlatform 2.2.1 or 2.3?

I only have option to add 2.1.1 or 2.0.1 with the "Add Jar Container", is there a way to add 2.2.1 or 2.3?

Or is there something else that's the matter?

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 6 guests

JavaCard OS : Disclaimer