hf gp: add GlobalPlatform info, crs and aids commands

New `hf gp` command family. Every subcommand works without keys and
never sends INITIALIZE UPDATE / EXTERNAL AUTHENTICATE, so no card
retry counter is used. All take -w for the contact interface, -a to
log APDUs and -v for verbose output.

hf gp info
  Selects the ISD, or the default applet when A000000151000000 is
  absent, and reads:
  - Card Recognition Data, decoding the GP version, SCP and Java Card
    version from their OIDs
  - CPLC, with the fabricator name and BCD dates decoded
  - the Key Information Template (KVN, key id, type, length, with
    SCP02 / SCP03 key sets marked)
  - IIN, CIN and the SCP sequence counter
  GET DATA retries with CLA 00 on cards that reject CLA 80.

hf gp crs
  GET STATUS on the Contactless Registry Service (GPC_SPE_025 3.11),
  following 6310 to fetch more data. Lists each applet's AID,
  lifecycle, contactless activation state, display data, URL, group
  and CREL members. --aid filters on a full or partial AID.

hf gp aids
  Finds applet AIDs by partial SELECT (P2=00, first occurrence):
  - finds the shortest prefix the card accepts
  - tries aidlist.json prefixes and every registered RID A0 00 00 0x xx
    (--quick skips the RID sweep)
  - extends each hit one byte at a time to the full AID
  - --prefix limits the search to one subtree
  Cards whose default applet accepts any SELECT are detected and
  refused. The walk is capped at 200000 APDUs and can be stopped with
  <Enter>. Without partial selection it falls back to the full
  aidlist.json AIDs.

aidlist.json gains the GP ISD, CRS and ARA-M AIDs, plus USIM, ISIM,
CSIM, UnionPay, and ICCOA so found AIDs get named. The CCC digital key entry gets a description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Christian HerrmannandClaude Opus 5.5 committed 2026-11-09 11:11:09 +07:00
1 parent f6ca733601
commit 4004a454de
10 files changed
+1378 -11

No files matched your search

+2
View File
@@ -38,6 +38,7 @@
#include "cmdhfsecc.h" // iClass SE Config Card
#include "cmdhffudan.h" // Fudan cards
#include "cmdhfgallagher.h" // Gallagher DESFire cards
#include "cmdhfgp.h" // GlobalPlatform
#include "cmdhfgst.h" // Google Smart Tap
#include "cmdhficlass.h" // ICLASS
#include "cmdhfict.h" // ICT MFC / DESfire cards
@@ -645,6 +646,7 @@ static command_t CommandTable[] = {
{"fmcos", CmdHFFmcos, AlwaysAvailable, "{ FMCOS CPU cards... }"},
{"fudan", CmdHFFudan, AlwaysAvailable, "{ Fudan RFIDs... }"},
{"gallagher", CmdHFGallagher, AlwaysAvailable, "{ Gallagher DESFire RFIDs... }"},
{"gp", CmdHFGP, AlwaysAvailable, "{ GlobalPlatform secure elements... }"},
{"gst", CmdHFGST, AlwaysAvailable, "{ Google Smart Tap passes... }"},
{"secc", CmdHFHIDConfig, AlwaysAvailable, "{ iClass SE Config Card Emulator... }"},
{"iclass", CmdHFiClass, AlwaysAvailable, "{ ICLASS RFIDs... }"},
+1157
View File
File diff suppressed because it is too large. Load diff
+36
View File
@@ -0,0 +1,36 @@
//-----------------------------------------------------------------------------
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// See LICENSE.txt for the text of the license.
//-----------------------------------------------------------------------------
// GlobalPlatform commands
//-----------------------------------------------------------------------------
#ifndef CMDHFGP_H__
#define CMDHFGP_H__
#include "common.h"
#include "iso7816/iso7816core.h"
int CmdHFGP(const char *Cmd);
// Find applet AIDs via partial SELECT, empty prefix sweeps known prefixes and registered RIDs
int gp_find_aids(Iso7816CommandChannel channel, const uint8_t *prefix, size_t prefix_len, bool quick, bool verbose);
// Read ISD info without authentication: card data, CPLC, key info, IIN, CIN
int gp_info(Iso7816CommandChannel channel, bool verbose);
// List contactless applets via the GP CRS application (no authentication needed)
int gp_crs_list(Iso7816CommandChannel channel, const uint8_t *aid, size_t aid_len, bool verbose);
#endif