Page 1 of 2

javacard ndef applet

Posted: Thu Oct 06, 2016 10:19 pm
by shimizus3106
Hello.

Please let me ask about an applet of NDEF on JavaCard.

I'm trying
https://github.com/promovicz/javacard-ndef

Simulation works well on Netbeans,
but on Real smard card, it doesnt work well.

Here is error status with GP tool.

---------------------------------------------------
I installed with refering to

java -jar gp.jar \
-params 100BD101075402656E54657374 \
-install javacard-ndef.cap

But, it doesnt work well.
APDU Command with GP tool below:
Success : 9000
A>> T=0 (4+0007) 00A40400 07 D2760000850101
A<< (0000+2) (41ms) 9000

But, next is not success
A>> T=0 (4+0002) 00A4000C 02 E103
A<< (0000+2) (26ms) 6A86
------------------------------------------------------

and simulation result is below

------------------------------------------------------
An instance //aid/D276000085/0101 is created for //aid/D276000085/01.
run-client:
run-script:
Invoking apdutool on C:\Users\shigenori shimizu\Downloads\prj\Netbeans\java-ndef.mod/scripts/java_ndef.scr
ApduTool [v3.0.2]
Copyright (c) 2009 Sun Microsystems, Inc.
All rights reserved.
Use is subject to license terms.
Opening connection to localhost on port 9025.
Connected.
Received ATR = 0x3b 0xf0 0x11 0x00 0xff 0x00
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 07, d2, 76, 00, 00, 85, 01, 01, Le: 00, SW1: 90, SW2: 00
CLA: 00, INS: a4, P1: 00, P2: 0c, Lc: 02, e1, 03, Le: 00, SW1: 90, SW2: 00
CLA: 00, INS: b0, P1: 00, P2: 00, Lc: 02, 00, 0f, Le: 0f, 00, 0f, 20, 00, 80, 00, 80, 04, 06, e1, 04, 00, 0d, 00, ff, SW1: 90, SW2: 00
CLA: 00, INS: a4, P1: 00, P2: 0c, Lc: 02, e1, 04, Le: 00, SW1: 90, SW2: 00
CLA: 00, INS: b0, P1: 00, P2: 00, Lc: 01, 02, Le: 0d, 00, 0b, d1, 01, 07, 54, 02, 65, 6e, 54, 65, 73, 74, SW1: 90, SW2: 00
CLA: 00, INS: b0, P1: 00, P2: 00, Lc: 02, 01, 12, Le: 0d, 00, 0b, d1, 01, 07, 54, 02, 65, 6e, 54, 65, 73, 74, SW1: 90, SW2: 00
----------------------------------------------------------

From Debugging on real smart card,
it cannot pick up fileId from APDU command.

I dont know why it isnot same between simulator and real smart card.

Could you let me know how to run correctlly ?

Regards,
Shige

Re: javacard ndef applet

Posted: Sat Oct 08, 2016 1:38 am
by mabel
6A 86 means incorrect parameters. What's your real card model? I can't see where can return the response 6A86 from the source code.

It should be returned by JCVM.

Re: javacard ndef applet

Posted: Mon Oct 10, 2016 12:40 am
by shimizus3106
Hello.

Thanks to your reply.

6A86 = 27270,
We can find - ISO7816.java

>> public static final short SW_INCORRECT_P1P2 = 27270;

and I often get other error pattern - 6A83 = 27266

>> public static final short SW_FILE_NOT_FOUND = 27266;


I dont know why the former error occur.

But, the latter case,

I guess that the error occur here

----------------------------------------
switch(fileId) {
case FILEID_NDEF_CAPABILITIES:
case FILEID_NDEF_DATA:
selectedFile = fileId;
break;
default:
ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND);
}
-----------------------------------------

But I dont know why the error occur there...

Regards,
Shige

Re: javacard ndef applet

Posted: Mon Oct 10, 2016 5:36 am
by mabel
I have done a test on J3D081 card with ndef applet. It can run without any problem.

So I guess, there is something wrong with your card.

Re: javacard ndef applet

Posted: Fri Oct 14, 2016 2:17 am
by shimizus3106
Hello.

Please let me confirm addtional question.

Are there any relation to the version of Java Card OS ?
or Card resource - memory - ?

Regards,
Shige

Re: javacard ndef applet

Posted: Fri Oct 14, 2016 5:08 am
by mabel
shimizus3106 wrote:Hello.

Please let me confirm addtional question.

Are there any relation to the version of Java Card OS ?
or Card resource - memory - ?

Regards,
Shige


Yes, I guess these is something wrong with your card OS.
Tell me your card model/type, maybe I can do some test for you.

Re: javacard ndef applet

Posted: Fri Oct 14, 2016 5:45 am
by shimizus3106
Hello.

Thanks to your quick reply.

My card is very dedicated and I don't know detail..
But OS seems that Java Card OS is ver 3.x..

Anyway to know requried information ? ex) with GP tool ?
If possible, I will tell information that I can disclose.

Regards,
Shige

Re: javacard ndef applet

Posted: Sat Oct 15, 2016 5:30 am
by mabel
Two ways to know the card details.

W1. Get ATR of your card and show it here.

W2. Get CPLC
> Select CardManager
> Send command
00 CA 9F 7F 00

Re: javacard ndef applet

Posted: Mon Oct 17, 2016 6:29 am
by shimizus3106
Hello.

I tried and Here is my answer about 1. ATR

1. ATR

3B6800000073C84000009000


Reagrds,
Shige

Re: javacard ndef applet

Posted: Mon Oct 17, 2016 10:37 pm
by mabel
shimizus3106 wrote:Hello.

I tried and Here is my answer about 1. ATR

1. ATR

3B6800000073C84000009000


Reagrds,
Shige


I can't see any card related information from the ATR.

Do you have other kinds of java cards, that can be used to test and verify this problem?