JCOP Cards
Meet the J2A040, J3R150 and J3R180, follow the card lifecycle from unfused and fused to SECURED and locked, and download sample gp.jar scripts.
Test cards only: made-up card numbers and test keys. Never put live card data or live keys on a test card.
NXP's JCOP cards are Java Cards: a chip with a small Java virtual machine and a GlobalPlatform security domain that loads, installs and deletes applets. The kit puts the KABC payment applets on three of them. This page tells them apart, follows a card through its life from the chip factory to the end, and gives you sample scripts to read a card and move it through that life yourself.
- The three cards: what each one is, and how to read its name.
- The card lifecycle: unfused and fused, then OP_READY, INITIALIZED, SECURED, CARD_LOCKED and TERMINATED.
- The applet lifecycle: loaded, installed, selectable and locked.
- Sample scripts to identify, list, lock, unlock, initialize and secure a card.
- Set the card's ATR: a test label and T=0 or T=1, and pre-personalizing an unfused J2A040.
- Good to know: three kinds of lock, failed logins and unfused cards.
1. The three cards
| J3R180 | J3R150 | J2A040 | |
|---|---|---|---|
| Platform | JCOP 4 on NXP's P71 chip (SmartMX3) | JCOP 4 on NXP's P71 chip (SmartMX3) | JCOP 2.4.1 release 3 |
| Java Card | 3.0.5 Classic | 3.0.5 Classic | 2.2.2 |
| GlobalPlatform | 2.3 | 2.3 | 2.1.1 |
| Memory | About 180 KB | About 150 KB | 40 KB EEPROM |
| Interfaces | Contact and contactless (ISO/IEC 14443 A) | Contact and contactless (ISO/IEC 14443 A) | Contact only |
| Security domain | A000000151000000 | A000000151000000 | A000000003000000 |
| Default key | 404142434445464748494A4B4C4D4E4F | ENC
90379A3E7116D455E55F9398736A01CAMAC
473F36161A7F7F60CC3A766EA4BE5247DEK D3749ED4FF42FD58B39EEB562B017CD9 | 404142434445464748494A4B4C4D4E4F |
| To build its CAP files | Java Card kit 3.0.5u4, javac 1.7 | Java Card kit 3.0.5u4, javac 1.7 | Java Card kit 2.2.2, javac 1.5 |
| Status | Current | Current | Discontinued by NXP. The J2A081 is the usual replacement; it is not tested with the kit. |
The default key is what settings.cmd and the kit's card.env come with. A card whose keys were changed needs its own: a wrong key counts down the card's retry counter, and the scripts stop at the first refusal.
How to read the name: J3R180
That is how the part numbers line up across NXP's range. Figures differ a little between card makers' configurations: the data sheet of the card in your hand is the reference. The kit's Check my setup and 1-identify.cmd read the card itself.
2. The card lifecycle
A GlobalPlatform card is always in one lifecycle state, kept by its security domain; 2-list.cmd prints it on its first line. Most steps go one way only. Pick a state to see what it means and what can come next.
Dashed: unfused, its pre-personalization still open; once pre-personalized it already works with gp.jar, and fusing is not needed for a test card. Solid: the GlobalPlatform states you drive with gp.jar and the scripts. Amber steps change the card; the red one bricks it for good.
OP_READY
GlobalPlatform code 01As soldA GlobalPlatform card whose security domain answers and holds its first keys. Fused cards are normally sold in this state with the default test key, and an unfused card that has been pre-personalized works the same way. A test card can stay here for good.
What works
- Load, install and delete applets: the kit's Install, Remove and Wipe.
- Select and use the applets: a terminal can run a transaction.
- Lock and unlock one applet.
- Change the keys.
What can come next
gp --initialize-card · the card receives 80 F0 80 075-initialize-card-ONE-WAY.cmd80 F0 80 FF.Every step
| Step | From | To | gp.jar | The card receives | Undo |
|---|---|---|---|---|---|
| Fuse Optional, one-way | Unfused | OP_READY | None: a pre-personalization command, not scripted | Not a GlobalPlatform command | No |
| Initialize One-way | OP_READY | INITIALIZED | gp --initialize-card |
80 F0 80 07 |
No |
| Secure One-way | INITIALIZED | SECURED | gp --secure-card |
80 F0 80 0F |
No |
| Lock the card Can be undone | SECURED | CARD_LOCKED | gp --lock-card |
80 F0 80 7F |
Unlock the card |
| Unlock the card Can be undone | CARD_LOCKED | SECURED | gp --unlock-card |
80 F0 80 0F |
Lock it again |
| Terminate Bricks the card | Any of the four | TERMINATED | None | 80 F0 80 FF |
No |
The card commands are GlobalPlatform SET STATUS: 80 F0, then 80 for the card itself and the new state's code. gp.jar sends them inside the secure channel after its login, so the card also checks their MAC.
3. The applet lifecycle
Each package and applet has a state of its own, separate from the card's: gp --list prints it after each AID, as in APP: A0000000041010 (SELECTABLE).
| State | Code | What it means | gp.jar |
|---|---|---|---|
| LOADED | 01 | A package from a CAP file is on the card: code, but no applet instance yet. | gp --load file.cap |
| INSTALLED | 03 | An applet instance exists but cannot be selected yet. | gp --install-only, rarely needed |
| SELECTABLE | 07 | A terminal can select it. The KABC applets stay here: their card data is built in, so they need no personalization step. | gp --install file.cap: load, install and make selectable in one go |
| LOCKED | 80 + state | It cannot be selected until it is unlocked: a terminal sees the card as if the application was not there. | gp --lock-applet AID, and back with gp --unlock-applet AID |
| (deleted) | Gone from the card. A package can only go once its applets are gone: --force deletes both. | gp --delete AID, with --force for a package |
The kit's Install loads, installs and makes each applet selectable in one go; Remove and Wipe delete. Locking an applet is how to test a card with one application missing without deleting it.
4. Sample scripts
Eight small Command Prompt scripts that run gp.jar for you. Each one says what it will do before it does it; the steps that cannot be undone ask you to type a word first, and after a failed login every script stops logging in until the key is fixed.
| Script | What it does | gp.jar | Care |
|---|---|---|---|
| Reads the ATR, the CPLC (who made the chip and when), the GlobalPlatform version and the key types. No login. | gp --info |
No login | |
| Shows the security domain with the card's state, then every applet and package with theirs. | gp --list |
Changes nothing | |
| Asks for an applet AID from the list and locks it: terminals cannot select it until it is unlocked. | gp --lock-applet AID |
Can be undone | |
| Asks for an applet AID and unlocks it: SELECTABLE again. | gp --unlock-applet AID |
Can be undone | |
| OP_READY to INITIALIZED. Asks you to type INITIALIZE first. | gp --initialize-card |
One-way | |
| INITIALIZED to SECURED, the state of an issued card. Asks you to type SECURE first. | gp --secure-card |
One-way | |
| SECURED to CARD_LOCKED: no application can be selected. Asks you to type LOCK first. | gp --lock-card |
Can be undone | |
| CARD_LOCKED back to SECURED. | gp --unlock-card |
Can be undone |
@echo off setlocal EnableExtensions title KABC JCOP card - 1 Identify the card echo 1 Identify the card. Your card: J3R180, JCOP 4 on NXP's P71 chip (SmartMX3). echo. echo Shows the card's ATR, its CPLC data (who made the chip, and when it was made and pre-personalized), echo its GlobalPlatform version and secure channel, and the types of its keys, never the keys themselves. echo It does not log in to the card, so it is safe to run as often as you like. echo. echo If gp.jar finds the card but shows no card data, it may be unfused and not pre-personalized yet: echo see the JCOP Cards page. set "NOLOGIN=1" call "%~dp0tools\gp.cmd" --info echo. pause
Then, on your PC
- Unzip it: right-click, Extract All.
- Have Java 11 or later and gp.jar. Put gp.jar next to the scripts, or leave it in your Downloads folder.
- Put the card in a contact reader and double-click
1-identify.cmd, then2-list.cmd. settings.cmdcomes with the J3R180's default test key already filled in. Open it in Notepad only to use a different key, or to name your reader when more than one is connected.
The card's key lives in settings.cmd and nowhere else; it is a test-card key, filled in as a default, not a secret. There is no script that changes the keys or terminates a card. To build and install the KABC applets, use the Build & Install Kit.
5. Set the card's ATR (test label)
A card answers every reader with an ATR (Answer To Reset); its historical bytes are a short label a terminal reads. These scripts set that label to NRT Test Only and choose the contact protocol, T=1 (the usual one, needed to load applets) or T=0. On the J2A040 the same script pre-personalizes an unfused card and loads the default test key. It is the verified sequence from the reference ATR tools, in the per-card download under atr\.
- T=1 to load applets. A card set to T=0 cannot have applets loaded; pick T=1 unless you have a reason not to.
- Remove applets first. On JCOP 4 the card often refuses the configuration while packages are still loaded. Clear them with the kit's Wipe, then set the ATR.
- Cold reset to see it. The new contact ATR appears after you take the card out and put it back in.
- No fuse. These scripts do not fuse or permanently lock the card; those commands are left out on purpose.
atr\set-atr-T1.cmd, for the J3R180@echo off setlocal EnableExtensions title KABC JCOP card - set the ATR (J3R180, T=1) echo Set the card's ATR historical bytes to the test label "NRT Test Only", protocol T=1. echo It writes the configuration in one authenticated session; gp.cmd uses the key in settings.cmd. echo If the card has applets or packages loaded, remove them first with the kit's Wipe, or the echo card may refuse these commands. echo The new contact ATR shows after a COLD reset: remove the card and put it back in. echo This does NOT fuse or permanently lock the card. echo. set "ANSWER=" set /p "ANSWER=Type ATR to write it, or press Enter to stop: " if /i not "%ANSWER%"=="ATR" goto :stopped call "%~dp0..\tools\gp.cmd" -c A000000151000000 --mode MAC ^ -s 80E2880007DF2B0410A50104 ^ -s 80E288000BDF2B08109E050578777102 ^ -s 80E2880007DF2B04109F010A ^ -s 80E2880010DF2B0D10A00A50564A434F5034534944 ^ -s 80E2880007DF2B0410A10100 ^ -s 80E2880007DF2B0410A20148 ^ -s 80E2880007DF2B0410A30120 ^ -s 80E2880007DF2B0410A40124 ^ -s 80E2880007DF2B0410900124 ^ -s 80E2880007DF2B0410980124 ^ -s 80E2880007DF2B04108C0108 ^ -s 80E2880007DF2B0410940108 ^ -s 80E288000EDF2B0B108D08F01300008131FE45 ^ -s 80E288000EDF2B0B109508F01300008131FE45 ^ -s 80E2880007DF2B04108E010D ^ -s 80E2880007DF2B041096010D ^ -s 80E2880013DF2B10108F0D4E52542054657374204F6E6C79 ^ -s 80E2880013DF2B1010970D4E52542054657374204F6E6C79 ^ -s 80E2880007DF2B0410AD0103 ^ -s 80E2880007DF2B0420150101 ^ -s 80E2880007DF2B04109C0146 ^ -s 80E2880008DF2B05F82602010F ^ -s 80E2880007DF2B0410C1015A ^ -s 80E2880008DF2B05108B021000 if errorlevel 1 goto :end echo. echo Done. Take the card out and put it back in (cold reset) to see the new ATR. goto :end :stopped echo Stopped. Nothing was sent to the card. :end echo. pause
Both ATR scripts are in the download above for the J3R180, in the atr\ folder.
Good to know
- "Lock" means three different things.
gp --lock-cardblocks the whole card (CARD_LOCKED, can be undone);gp --lock-appletblocks one applet (can be undone);gp --lockis gp.jar's name for changing the card's keys Can brick the card. No script does the last one: keep the default key on a test card, and if you do change it, keep the new key safe first — lose it and the card is gone. - A failed login is never harmless. Can brick the card Each failed login counts down the security domain's retry counter; at zero the card is locked for good. The scripts and the kit stop at the first one.
- A test card does not need fusing. An unfused card that has been pre-personalized (on a J2A040, with the ATR script above) installs, lists and deletes applets just like a fused one, and it stays resettable: run the pre-personalization again to re-initialize it, reset its ATR and protocol, or reload its keys. Fusing makes that configuration permanent and takes the reset away, so keep development cards unfused and fuse only a card that is finished. Whether a card's pre-personalization matches the script depends on its profile, which differs by maker. If
1-identify.cmdfinds the card but shows no card data, it may be unfused and not pre-personalized yet. - Read the card's history.
1-identify.cmdprints the CPLC (Card Production Life Cycle) data, as the chip and card makers wrote it: the chip's fabrication date, who pre-personalized it and when, and the personalization date. - A test card can stay in OP_READY. Nothing on these pages needs another state. INITIALIZED and SECURED are worth trying on a spare card, to see a card the way issuers ship it.
- Install over contact. Applets are loaded through a contact reader. The J3R150 and J3R180 then also work contactless at a terminal; the J2A040 is contact only.
- No terminate script. Bricks the card TERMINATED is the end of a card, with no undo, so neither the scripts nor the kit go there.