Page 1 of 2

save applet persistent on the card

Posted: Mon Aug 24, 2020 12:21 pm
by andromeda92
hi,
with JCIDE 6.0.2.3 (javacard kit 2.2.2 NXP J2A040 ) I downloaded the application and installed it on the card, then I selected the applet, everything works fine,
but then how do I use the applet on the card? the goal is to develop an application with a language for example C # and sent ADPU sequences,
except that the applet is not persistent, I can only use it with JCIDE and each time I have to download, install and select the applet.
Do you have any idea how to make the applet final saved on the smart card ?

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 3:39 am
by kuafu
When you download applet with JCIDE. It just download the applet into a simulator. You need a card reader , a java card .
You can download applet into a java card via card reader. pyApdutoolviewtopic.php?f=3&t=38 can help you.

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 6:55 am
by andromeda92
On JCIDE i can download, install and select applet but with tool PyAdpuTool, is not possible i have error for download install and verufy GP key.

For download:
Download Cap error: GP init update failed. recv: 69 82

Basic ADPU:

Code: Select all

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 88 18 13 5D A6 17 90 02 11 04 95 01 34 80 01 88 81 01 10 84 08 80 80 80 80 80 80 80 80 5F 49 41 04 A1 DE D6 E9 BC D6 F1 73 E7 93 36 DC 6E 68 BC 87 0A 9F 28 FD AE 56 99 E6 20 BF 27 25 D7 C1 1F D9 45 47 D2 83 C0 22 D9 98 E6 1C 4A DC 06 ED DC B8 AC 23 11 22 12 FA 22 47 10 36 68 31 2D 61 2D AA
>>69 85

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 50 00 00 08 F5 4A E2 31 B3 77 93 6A 1C
>>69 82
for install:
Install Applet error: GP init update failed. recv: 69 82

Code: Select all

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 88 18 13 5D A6 17 90 02 11 04 95 01 34 80 01 88 81 01 10 84 08 80 80 80 80 80 80 80 80 5F 49 41 04 A1 DE D6 E9 BC D6 F1 73 E7 93 36 DC 6E 68 BC 87 0A 9F 28 FD AE 56 99 E6 20 BF 27 25 D7 C1 1F D9 45 47 D2 83 C0 22 D9 98 E6 1C 4A DC 06 ED DC B8 AC 23 11 22 12 FA 22 47 10 36 68 31 2D 61 2D AA
>>69 85

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 50 00 00 08 98 11 A5 39 55 F0 08 FF 1C
>>69 82

GP Verify:
GP Verify error: GP init update failed. recv: 69 82

Code: Select all

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 88 18 13 5D A6 17 90 02 11 04 95 01 34 80 01 88 81 01 10 84 08 80 80 80 80 80 80 80 80 5F 49 41 04 A1 DE D6 E9 BC D6 F1 73 E7 93 36 DC 6E 68 BC 87 0A 9F 28 FD AE 56 99 E6 20 BF 27 25 D7 C1 1F D9 45 47 D2 83 C0 22 D9 98 E6 1C 4A DC 06 ED DC B8 AC 23 11 22 12 FA 22 47 10 36 68 31 2D 61 2D AA
>>69 85

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 50 00 00 08 4B 40 01 59 A7 DA 07 21 1C
>>69 82
Card is locked ?
Thanls for your response.

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 7:28 am
by kuafu
andromeda92 wrote:
Wed Aug 26, 2020 6:55 am
On JCIDE i can download, install and select applet but with tool PyAdpuTool, is not possible i have error for download install and verufy GP key.

For download:
Download Cap error: GP init update failed. recv: 69 82

Basic ADPU:

Code: Select all

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 88 18 13 5D A6 17 90 02 11 04 95 01 34 80 01 88 81 01 10 84 08 80 80 80 80 80 80 80 80 5F 49 41 04 A1 DE D6 E9 BC D6 F1 73 E7 93 36 DC 6E 68 BC 87 0A 9F 28 FD AE 56 99 E6 20 BF 27 25 D7 C1 1F D9 45 47 D2 83 C0 22 D9 98 E6 1C 4A DC 06 ED DC B8 AC 23 11 22 12 FA 22 47 10 36 68 31 2D 61 2D AA
>>69 85

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 50 00 00 08 F5 4A E2 31 B3 77 93 6A 1C
>>69 82
for install:
Install Applet error: GP init update failed. recv: 69 82

Code: Select all

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 88 18 13 5D A6 17 90 02 11 04 95 01 34 80 01 88 81 01 10 84 08 80 80 80 80 80 80 80 80 5F 49 41 04 A1 DE D6 E9 BC D6 F1 73 E7 93 36 DC 6E 68 BC 87 0A 9F 28 FD AE 56 99 E6 20 BF 27 25 D7 C1 1F D9 45 47 D2 83 C0 22 D9 98 E6 1C 4A DC 06 ED DC B8 AC 23 11 22 12 FA 22 47 10 36 68 31 2D 61 2D AA
>>69 85

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 50 00 00 08 98 11 A5 39 55 F0 08 FF 1C
>>69 82

GP Verify:
GP Verify error: GP init update failed. recv: 69 82

Code: Select all

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 88 18 13 5D A6 17 90 02 11 04 95 01 34 80 01 88 81 01 10 84 08 80 80 80 80 80 80 80 80 5F 49 41 04 A1 DE D6 E9 BC D6 F1 73 E7 93 36 DC 6E 68 BC 87 0A 9F 28 FD AE 56 99 E6 20 BF 27 25 D7 C1 1F D9 45 47 D2 83 C0 22 D9 98 E6 1C 4A DC 06 ED DC B8 AC 23 11 22 12 FA 22 47 10 36 68 31 2D 61 2D AA
>>69 85

<<00 A4 04 00 00
>>6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6E 06 47 91 00 78 33 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 02 6E 01 02 90 00

<<80 50 00 00 08 4B 40 01 59 A7 DA 07 21 1C
>>69 82
Card is locked ?
Thanls for your response.
gp verify failed. You need to set the gp key of you card. Card vendor hold the gp key.

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 10:04 am
by andromeda92
With JCOP Manager i have this. What does it mean?

https://imgur.com/REhfCxf

Thanks in advance.

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 10:13 am
by kuafu
andromeda92 wrote:
Wed Aug 26, 2020 10:04 am
With JCOP Manager i have this. What does it mean?

https://imgur.com/REhfCxf

Thanks in advance.
About GP , You can learn something from this https://github.com/martinpaljak/GlobalPlatformPro

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 1:31 pm
by andromeda92
thank you for the link, my problem its because i have not key, i have default key.

I can put key with this command
for example ?

Code: Select all



Set 010B0371D78377B801F2D62AFC671D95 key to a card with default 40..4F keys:

gp -lock 010B0371D78377B801F2D62AFC671D95

Set default 40..4F keys to card that was previously locked with key 010B0371D78377B801F2D62AFC671D95:

gp -key 010B0371D78377B801F2D62AFC671D95 -unlock
i need to put key from my card that I used for the initialization ? or the key below:

Code: Select all

dek key
enc key
mac key
I don't know the keys above, i have buy my card on amazon, for the key initialization i have see it on youtube.

Thanks for your response.

when i test any gp command i have this

Code: Select all

Warning: no keys given, defaulting to 404142434445464748494A4B4C4D4E4F
Failed to open secure channel: Card cryptogram invalid!
Received: 750FCB6328FB71D4
Expected: A355C15668AEDF2C
!!! DO NOT RE-TRY THE SAME COMMAND/KEYS OR YOU MAY BRICK YOUR CARD !!!
Read more from https://github.com/martinpaljak/GlobalPlatformPro/wiki/Keys
I have probably tested more than 10 times, I think my card is blocked.

is there a step-by-step tutorial on how to prepare a blank card, after having been initialized, explaining where the keys are, what keys have been used, with the commands at each step, if I buy another card at $ 20, because in France it is the price, I will block it like my previous card.

Is there a JCOP card distributor that gives all the card information such as the user pin, admin pin, enc-key, dek-key, C-mac, the TK KEY to initialize the card? or is there a card already initialized with all the keys on the card, or i would just have to download the applet and install it in the card without worrying about the keys?

it's a shame because I was really interested in javacard, I find it very difficult just to prepare a map compared to ACOS3 boards, apart from the specifications of the globalPlateform document which is very hard to understand, I find it weird that it does There is no tutorial on this subject, I have looked on the internet, many people have the same problem as me and do not have the solution unless they know experts in this field personally.


Thanks in advance.

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 5:37 pm
by andromeda92
i have tested this with gp.exe

Code: Select all

# gp --unlock-card -r Athena ASEDrive IIIe USB 0 -v
# GlobalPlatformPro 325fe84
# Running on Windows 10 10.0 amd64, Java 1.8.0_241 by Oracle Corporation
Warning: no keys given, defaulting to 404142434445464748494A4B4C4D4E4F
[INFO] GPSession - Using card master keys with version 0 for setting up session [MAC]
[INFO] GPSession - Diversified card keys: ENC=404142434445464748494A4B4C4D4E4F (KCV: 8BAF47) MAC=404142434445464748494A4B4C4D4E4F (KCV: 8BAF47) DEK=404142434445464748494A4B4C4D4E4F (KCV: 8BAF47) for SCP02
[INFO] GPSession - Session keys: ENC=010B0371D78377B801F2D62AFC671D95 MAC=D1C28C601652A4770D67AD82D2D2E1C4 RMAC=FFAEC7EC7FAD69F9FBFF093BF2F79C45
Failed to open secure channel: Card cryptogram invalid!
Received: 7D9A5888A2D02C47
Expected: 3CD7D5EF6CF69C59
!!! DO NOT RE-TRY THE SAME COMMAND/KEYS OR YOU MAY BRICK YOUR CARD !!!
Read more from https://github.com/martinpaljak/GlobalPlatformPro/wiki/Keys

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 7:51 pm
by andromeda92
I'll buy another card and try the script at the end of the page on the link below, because i used the fuse ADPU and now is blocked.

https://javacardos.com/javacardforum/vi ... .php?t=996

I will receive the card on Sunday and I will tell you if it works, hoping that I will not block it again.

Re: save applet persistent on the card

Posted: Wed Aug 26, 2020 8:32 pm
by kuafu
andromeda92 wrote:
Wed Aug 26, 2020 7:51 pm
I'll buy another card and try the script at the end of the page on the link below, because i used the fuse ADPU and now is blocked.

https://javacardos.com/javacardforum/vi ... .php?t=996

I will receive the card on Sunday and I will tell you if it works, hoping that I will not block it again.
You can ask the customer service staff of to customized the card with the gp key that you want. I had buy card from them before.
But you need to ask them to do that.