GPSHELL3(1)
โจ welcome to GPShell3 Documentation bestie โจ this is GPSHELL3(1), and we're about to have a whole moment ๐
๐ NAME ๐
gpshell3 โ the simplified command line tool for managing GlobalPlatform compliant smart cards ๐ซถ
โจ SYNOPSIS โจ
gpshell3 [global-options] <command> [command-args] [then <command> [command-args] ...]
๐ DESCRIPTION ๐
okay so gpshell3 is a modern, simplified CLI for GlobalPlatform card management, and honestly? it ate. it gives you a concise little set of commands for listing, installing and deleting applications, managing keys, opening secure channels, sending raw APDUs, and doing personalization steps โ all while following the GlobalPlatform Card specification ๐
so here's the tea: unlike the legacy gpshell (which was script-driven, iykyk), gpshell3 is argument-driven and is literally designed to be easy to use interactively, in shell scripts, or on CI systems. every command works against PC/SC readers and uses the in-tree GlobalPlatform library ๐ฆ
unless otherwise specified, gpshell3 will:
- connect to the first available PC/SC reader;
- select a suitable Issuer Security Domain (ISD) AID automatically (
A000000151000000,A0000001510000, orA000000003000000); - open a Secure Channel using defaults listed below when a command requires security (e.g., install, delete, key management).
๐ GLOBAL OPTIONS ๐
-r,--reader<name|num> โ PC/SC reader name or 1-based number. Default: first present reader.--protocol<auto|t0|t1> โ Transport protocol. Default:auto.--sdโ ISD AID to select explicitly (hex). By defaultgpshell3will try, in order:A000000151000000(GP 2.3.1 ISD)A0000001510000(GP 2.1.1 CM)A000000003000000(OP 2.0.1 CM)
--sec<mac|mac+enc|mac+enc+rmac> โ Secure Channel security level. Default:mac+enc.--scpโ Secure Channel Protocol number, e.g.1,2,3,11.0x11is also accepted for SCP11. Normally auto-detected.--scp-implโ SCP implementation as a hex value (e.g.,15,55). Normally auto-detected.--scp11-certโ Optional SCP11 OCE certificate chain file submitted via PERFORM SECURITY OPERATION before SCP11 mutual authentication. The file must contain DER TLV certificates (30or7F21), optionally wrapped inBF21.--scp11-sd-public-key<hex|pem> โ Optional SCP11 SD ECKA public key (PK.SD.ECKA) supplied out-of-band for SCP11a. The value may be a PEM public-key file, a PEM private-key file containing the corresponding public key, a raw uncompressed P-256 EC point starting with04, or theB0 41 04...TLV returned by compatible SD key-generation flows. When this option is present,gpshell3does not retrieve CERT.SD.ECKA with GET DATABF21during SCP11a mutual authentication.--scp11-session-key-lengthโ Requested SCP11 AES session key length in bytes. Valid values are16,24, and32;0x10,0x18, and0x20are also accepted. Default:16. This controls the SCP11 key agreement data tag81and is independent of the raw OCE private key length passed with--key.--kvโ Key set version to use for mutual authentication. Default:0.--idxโ Key index within the key set for mutual authentication. Default:0.--derive<none|visa2|emv> โ Key derivation method when authenticating with a single base key.none(default): use keys as provided.visa2: VISA2 derivation (a.k.a. VISA key derivation).emv: EMV CPS 1.1 derivation.
--keyโ Base key (hex) used to derive ENC/MAC/DEK when--deriveis notnone. If--enc/--mac/--dekare not provided and no derivation is provided, this base key is also used directly for SCP02. For SCP11, this is the raw SK.OCE.ECKA private key; use--scp11-session-key-lengthto choose the requested AES session key length. Default: bytes40..4F(16 bytes).--enc,--mac,--dekโ Explicit S-ENC, S-MAC and DEK keys (hex) for mutual authentication. If provided together,--keyis ignored.-v,--verboseโ Verbose output. SetsGLOBALPLATFORM_DEBUG=1andGLOBALPLATFORM_LOGFILE=stderr.-t,--traceโ Print APDU trace (hex APDUs and status words).-h,--helpโ Show usage.
๐ COMMANDS ๐
๐ธ list-apps
List Issuer Security Domains, Security Domains, Applications, Load Files and Executable Modules. Output includes:
- AIDs and life cycle states;
- associated Security Domain AIDs;
- a virtual Unassigned group for entries that are not linked to any Security Domain;
- privileges in short-name form like
priv=[sd,cm-lock,...].
Example:
gpshell3 list-apps
๐ฆ list-keys
List key information grouped by key set version (kv), including key types and size โจ
Example:
gpshell3 list-keys
๐ list-readers
List available PC/SC readers. that's it, that's the whole vibe ๐ซถ
๐ install
Load a CAP file and install/make selectable applet instances ๐ฅ
Synopsis:
gpshell3 install [--load-only|--install-only]
[--dap <hex>|@<file>] [--dap-sd <AIDhex>] [--load-token <hex>] [--install-token <hex>]
[--hash <hex>] [--load-file <AIDhex>] [--applet <AIDhex>] [--module <AIDhex>]
[--params <hex>] [--v-data-limit <size>] [--nv-data-limit <size>]
[--priv <p1,p2,...>] <cap-file>
๐ Options
--applet <AIDhex>: Sets the applet instance AID (usually same as module) (optional).--module <AIDhex>: Module AID to install (optional). If omitted, installs all applets from the CAP.--params <hex>: Installation parameters (hex) passed to the appletinstall()method (optional).--priv <list>: Comma-separated privileges by short names. See "Privileges" below (optional).--v-data-limit <size>: Volatile data storage limit in bytes (optional).--nv-data-limit <size>: Non-volatile data storage limit in bytes (optional).--load-only: Perform INSTALL [for load] + LOAD only, skip installation/make-selectable.--install-only: Perform only INSTALL [for install] and make-selectable. Requires--load-file,--module, and--applet.--load-file <AID>: AID of the load file (required for--install-only).--dap <hex>|@file: DAP signature as hex or binary file. If used,--hashmust provide the precomputed load-file data block hash.--dap-sd <AIDhex>: Security Domain AID to embed into theGP211_DAP_BLOCKpassed to LOAD (this SD verifies the DAP signature; defaults to--sd).--hash <hex>: Precomputed load-file data block hash (hex) required when--dapis supplied.--load-token <hex>/--install-token <hex>: Tokens for delegated management (optional).
๐ Delegated management note, listen up: the selected Security Domain (--sd, the one used for SCP/authentication) is also used as the target Security Domain AID in INSTALL [for load]. In typical DM flows this means the delegated management SD is also the receiving/associated SD for the loaded package and installed applets. no cap, that one matters.
๐ Examples
# Load and install with default security settings
gpshell3 install ./helloworld.cap
# Load only (stage package without creating instances)
gpshell3 install --load-only ./helloworld.cap
# Install only from an already loaded package
gpshell3 install --install-only \
--load-file A00000000101 \
--module A00000000101 \
--applet A0000000010101 \
--params 80
๐ง Delegated Management Token Workflow
For delegated management, token verification must match both the key material on card and the exact APDU payload. it's giving "every detail counts" energy, so:
- Select/authenticate the delegated management Security Domain using global
--sd <AIDhex>and valid SCP keys. - Provision the matching public token verification key with
put-dm-token. - Generate tokens with the corresponding private key using
sign-*-tokencommands. - Pass the generated token bytes into the operation (
install --load-token,install --install-token,delete --token,move --token,update-registry --token).
Important parameter matching rules ๐
sign-load-token <cap-file> <sd-aid> ...:<sd-aid>must be the same SD AID used as--sdduring install.- It must also be the target SD AID used in INSTALL [for load].
sign-install-token <load-file-aid> <module-aid> <app-aid> ...:- All AIDs, privileges, limits, and parameters must match the INSTALL [for install and make selectable] command.
sign-extradition-token/sign-update-registry-token:<sd-aid>must match the Security Domain AID used by the corresponding command.
๐ If these fields differ, cards typically reject the command with status words such as6982/6985. so like... don't do that.
โญ install-sd
Install an Issuer Security Domain instance ๐
Synopsis:
gpshell3 install-sd [--load-file <AIDhex>] [--module <AIDhex>] [--expl-personalized]
[--priv <list>] [--extradition-here <list>] [--delete-here <list>]
[--extradition-away <list>] <instance-aid>
๐ซ Options
--load-file <AIDhex>: Load file / package AID to use (optional). Defaults toA0000000035350orA0000001515350if found on card.--module <AIDhex>: Module AID to use (optional). Defaults toA000000003535041orA000000151535041if found on card.--expl-personalized: Include explicit personalized state tag in SD parameters (optional).--priv <list>: Comma-separated privileges by short names. See "Privileges" below (optional). Note:GP211_SECURITY_DOMAINis automatically added.--extradition-here <list>: Accept extradition to this SD (optional, defaultisd).--delete-here <list>: Accept deletion (optional, defaultisd).--extradition-away <list>: Accept extradition away from this SD (optional, defaultisd).
The <list> value is a comma-separated list; tokens can be ORed:
none: SD does not accept the operation (default policy if the tag is not present).an-am: accept from an ancestor SD with AM privilege.am: accept from any SD in its hierarchy with AM privilege.isd: accept from Issuer Security Domain.an-am-dm: accept from any SD with DM privilege under an ancestor SD with AM.all-am: accept from every SD with AM privilege on the card.
Example:
gpshell3 install-sd --extradition-here isd --delete-here isd --extradition-away isd A0000001510000
๐ delete
Delete an application instance or load file by AID ๐
Synopsis:
gpshell3 delete [--token <hex>] <AIDhex>
๐ธ Options
--token <hex>: Optional delegated-management delete token (encoded with tag9F).<AIDhex>: AID of the application instance or load file to delete.
Example:
gpshell3 delete A0000000010101
update-registry ๐ ๏ธ
Okay so this one updates the registry for an application โ think changing privileges and that kind of glow-up. <pink>bestie</pink>, itโs giving โpaperwork but make it secure.โ
Synopsis:
gpshell3 update-registry [--sd <AIDhex>] [--priv <p1,p2,...>] [--token <hex>] <AIDhex>
Options:
<AIDhex>โ AID of the application instance to be updated (mandatory, last positional parameter).--sd <AIDhex>โ AID of the target Security Domain (optional).--priv <list>โ Comma-separated privileges by short names. Peep the โPrivilegesโ section below (optional).--token <hex>โ Optional delegated-management registry update token.
Example:
gpshell3 update-registry --sd A000000151000000 --priv default-selected A0000000010101
move ๐
Move an application to a different Security Domain. Yes, this is the extradition command โ <hotpink>main character energy</hotpink> for your app, fr fr.
Synopsis:
gpshell3 move [--token <hex>] <applicationAID> <securityDomainAID>
Options:
<applicationAID>โ AID of the application instance to be moved.<securityDomainAID>โ AID of the target Security Domain.--token <hex>โ Optional delegated-management extradition token.
Example:
gpshell3 move A0000000010101 A00000015100000002
verify-delete-receipt ๐งพ
Verify a Delete receipt from a response APDU (R-APDU). <lavender>Receipt says what it says.</lavender>
Synopsis:
gpshell3 verify-delete-receipt [--type <des|aes|rsa|ecc>] [--key <hex>|--pem <file>[:pass]] --aid <AIDhex> <response-apdu-hex>
Options:
--aid <AIDhex>โ Application instance or Executable Load File AID (mandatory).--typeโ Receipt verification key type. Default:aes.--key <hex>โ Symmetric DES/AES receipt key (required for--type des|aes).--pem <file>[:pass]โ Public key PEM (required for--type rsa|ecc).<response-apdu-hex>โ Response APDU hex with or without trailing9000(mandatory, last positional parameter).
The command parses and prints Confirmation Data (counter, SD Unique Data, optional token fields) before signature/MAC verification. <cyan>Order matters, iykyk.</cyan>
verify-load-receipt ๐ฆ
Verify a Load receipt from a response APDU.
Synopsis:
gpshell3 verify-load-receipt [--type <des|aes|rsa|ecc>] [--key <hex>|--pem <file>[:pass]] --load-file <AIDhex> --sd <AIDhex> <response-apdu-hex>
Options:
--load-file <AIDhex>โ Executable Load File AID (mandatory).--sd <AIDhex>โ Security Domain AID (mandatory).--typeโ Receipt verification key type. Default:aes.--key <hex>โ Symmetric DES/AES receipt key (required for--type des|aes).--pem <file>[:pass]โ Public key PEM (required for--type rsa|ecc).<response-apdu-hex>โ Response APDU hex with or without trailing9000(mandatory, last positional parameter).
verify-install-receipt ๐
Verify an Install receipt from a response APDU.
Synopsis:
gpshell3 verify-install-receipt [--type <des|aes|rsa|ecc>] [--key <hex>|--pem <file>[:pass]] --load-file <AIDhex> --aid <AIDhex> <response-apdu-hex>
Options:
--load-file <AIDhex>โ Executable Load File AID (mandatory).--aid <AIDhex>โ Application instance AID (mandatory).--typeโ Receipt verification key type. Default:aes.--key <hex>โ Symmetric DES/AES receipt key (required for--type des|aes).--pem <file>[:pass]โ Public key PEM (required for--type rsa|ecc).<response-apdu-hex>โ Response APDU hex with or without trailing9000(mandatory, last positional parameter).
verify-move-receipt ๐
Verify a Move (Extradition) receipt from a response APDU.
Synopsis:
gpshell3 verify-move-receipt [--type <des|aes|rsa|ecc>] [--key <hex>|--pem <file>[:pass]] --aid <AIDhex> --oldsd <AIDhex> --newsd <AIDhex> <response-apdu-hex>
Options:
--aid <AIDhex>โ Application instance or Executable Load File AID (mandatory).--oldsd <AIDhex>โ Old Security Domain AID (mandatory).--newsd <AIDhex>โ New Security Domain AID (mandatory).--typeโ Receipt verification key type. Default:aes.--key <hex>โ Symmetric DES/AES receipt key (required for--type des|aes).--pem <file>[:pass]โ Public key PEM (required for--type rsa|ecc).<response-apdu-hex>โ Response APDU hex with or without trailing9000(mandatory, last positional parameter).
verify-registry-update-receipt ๐ง
Verify a Registry Update receipt from a response APDU. <mint>This is the receipt for the registry glow-up.</mint>
Synopsis:
gpshell3 verify-registry-update-receipt [--type <des|aes|rsa|ecc>] [--key <hex>|--pem <file>[:pass]] --aid <AIDhex> --oldsd <AIDhex> --newsd <AIDhex> --priv <list> <response-apdu-hex>
Options:
--aid <AIDhex>โ Application AID (mandatory).--oldsd <AIDhex>โ Old Security Domain AID (mandatory).--newsd <AIDhex>โ New Security Domain AID (mandatory).--priv <list>โ Privileges encoded exactly likeinstall --priv(mandatory).--typeโ Receipt verification key type. Default:aes.--key <hex>โ Symmetric DES/AES receipt key (required for--type des|aes).--pem <file>[:pass]โ Public key PEM (required for--type rsa|ecc).<response-apdu-hex>โ Response APDU hex with or without trailing9000(mandatory, last positional parameter).
status ๐
Set the lifecycle state of a card element. <purple>Vibe check but for card elements.</purple>
Synopsis:
gpshell3 status <isd|sd|app|sd-app> --lc <state> <AIDhex>
Options:
<isd|sd|app|sd-app>โ Target element type.--lc <state>โ Target lifecycle state (mandatory).<AIDhex>โ AID of the target element.
Element types and allowed states:
isdโlocked,terminated(WARNING:terminatedis permanent.)sdโpersonalized,lockedappโlocked,selectablesd-appโlocked
No cap: terminated is permanent. Treat it like a real-life block button, not a little test ๐
put-auth ๐
Set secure channel keys (S-ENC, S-MAC, DEK) for a key set.
Synopsis:
gpshell3 put-auth [--type <aes|3des>] [--derive <none|emv|visa2>] --kv <ver> [--new-kv <ver>] [--key <hex> | --enc <hex> --mac <hex> --dek <hex>]
Options:
- Use either a single
--key(with optional--derive) OR all of--enc/--mac/--dek. --kv <ver>โ Key set version, defaults to1,0means that a new key set is created (optional).--new-kv <ver>โ New key set version when replacing keys, defaults to1(optional).--typedefaults toaes.
The synopsis also gives you --type <aes|3des> and --derive <none|emv|visa2> โ <yellow>donโt skip the synopsis bestie, itโs literally right there</yellow>.
put-key ๐๏ธ
Put (add or replace) a key in a key set.
Synopsis:
gpshell3 put-key [--type <3des|aes|rsa|ecc|ecc-private>] --kv <ver> --idx <idx> --new-kv <ver> [--ecc-curve <explicit|reference>] (--key <hex>|--pem <file>[:pass])
Options:
--kv <ver>โ Key set version (mandatory).--idx <idx>โ Key index within the set (mandatory).--new-kv <ver>โ New key set version when replacing keys (mandatory).- For
--type aes|3des|ecc-private: provide the key via--key <hex>. - For
--type rsa|ecc: provide a public key in PEM via--pem <file>[:pass]. --ecc-curve <explicit|reference>โ For ECC keys, embed the curve parameters from the PEM file (explicit, default) or send the curve parameter reference derived from the PEM curve (reference).
put-dm-token ๐ช
Put delegated management token verification key.
Synopsis:
gpshell3 put-dm-token --kv <ver> [--new-kv <ver>] [--token-type <rsa|ecc>] <pem-file>[:pass]
Options:
--kv <ver>โ Key set version, defaults to0,0means that a new key set is created (optional).--new-kv <ver>โ New key set version when replacing or creating a new key set, default0x70(optional).<pem-file>[:pass]โ Token verification public key in PEM, optional passphrase after colon.--token-typeโ Token key type,rsaorecc(defaultrsa).
put-dm-token stores the token verification public key on card. sign-load-token, sign-install-token, sign-extradition-token, sign-update-registry-token, and sign-delete-token must use the matching private key to create tokens accepted by that verification key. <pink>Matching pairs only, bestie โ this is not a mix-and-match situation.</pink>
put-dm-receipt ๐งพโจ
Put delegated management receipt key.
Synopsis:
gpshell3 put-dm-receipt --kv <ver> [--new-kv <ver>] [--receipt-type <aes|des>] <receipt-key-hex>
Options:
--kv <ver>โ Key set version, defaults to0,0means that a new key set is created (optional).--new-kv <ver>โ New key set version when replacing or creating a new key set, default0x71(optional).<receipt-key-hex>โ Receipt key material (last positional parameter).--receipt-typeโ Receipt key type,aesordes(defaultaes).
put-dap-key ๐ก๏ธ
Put DAP verification key (asymmetric or symmetric).
Synopsis:
gpshell3 put-dap-key [--kv <ver>] [--new-kv <ver>] [--key-type <ecc|rsa|aes|3des>] <pem-file>[:pass]|<key-hex>
Options:
--kv <ver>โ Key set version, defaults to0,0means that a new key set is created (optional).--new-kv <ver>โ New key set version when replacing or creating a new key set, default0x73(optional).--key-typeโ DAP key type,ecc,rsa,aes, or3des(defaultecc).- For
--key-type ecc|rsa: provide public key PEM as<pem-file>[:pass]. - For
--key-type aes|3des: provide symmetric key material as<key-hex>.
del-key ๐๏ธ
Delete a key or an entire key set. <red>Be so serious when you use this one.</red>
Synopsis:
gpshell3 del-key --kv <ver> [--idx <idx>]
Options:
--kv <ver>โ Key set version (mandatory).--idx <idx>โ Key index within the set. If--idxis omitted, the entire key setkvis deleted.
apdu ๐ก
Send raw APDUs. Multiple APDUs can be supplied as separate arguments or separated by ; or , in a single argument. APDUs can be continuous hex (00A40400) or space-separated (00 A4 04 00). <cyan>Yes, both. The command ate.</cyan>
Synopsis:
gpshell3 apdu [--auth] [--nostop|--ignore-errors] <APDU> [<APDU> ...]
Options:
--authโ Perform default ISD selection and mutual authentication before sending APDUs.--nostop/--ignore-errorsโ Continue even if an APDU returns an error status (non-9000).
hash ๐งฎ
Compute the load-file data block hash of a CAP file.
Synopsis:
gpshell3 hash <cap-file> [--sha1|--sha256|--sha384|--sha512|--sm3]
Default hash algorithm: sha256. <green>sha256 is the main character unless you say otherwise.</green>
sign-dap โ๏ธ
Generate a DAP signature from a precomputed hash.
Synopsis:
gpshell3 sign-dap aes [--output <file>] <hash-hex> <hexkey>
gpshell3 sign-dap rsa [--output <file>] <hash-hex> <pem>[:pass]
gpshell3 sign-dap ecc [--output <file>] <hash-hex> <pem>[:pass]
Writes the signature bytes to stdout unless --output is provided. For ecc, the signature is encoded in plain format according to BSI TR-03111 (r||s). <lavender>That r||s is iconic and also load-bearing โ keep it exactly like that.</lavender>
sign-load-token ๐งพ๐
Calculate a Load Token using a private RSA or ECC key.
Synopsis:
gpshell3 sign-load-token [--output <file>] [--v-data-limit <n>] [--nv-data-limit <n>] <cap-file> <sd-aidhex> <hash-hex> <pem>[:pass]
The executable load file AID and non-volatile code limit are read from <cap-file>. <pink>It pulls those details directly from the CAP file, no cap.</pink>
sign-install-token ๐งพ๐
Calculate an Install Token using a private RSA or ECC key.
Synopsis:
gpshell3 sign-install-token [--output <file>] [--p1 <n>] [--priv <n>] [--v-data-limit <n>] [--nv-data-limit <n>] [--params <hex>] [--sd-params <hex>] [--uicc-params <hex>] [--sim-params <hex>] <load-file-aidhex> <module-aidhex> <app-aidhex> <pem>[:pass]
sign-extradition-token ๐ซ
Bestie, this one calculates an Extradition Token using a private RSA or ECC key. Iykyk.
Synopsis:
gpshell3 sign-extradition-token [--output <file>] <sd-aidhex> <app-aidhex> <pem>[:pass]
sign-update-registry-token ๐
This calculates a Registry Update Token using a private RSA or ECC key. Slay.
Synopsis:
gpshell3 sign-update-registry-token [--output <file>] [--priv <n>] [--registry-params <hex>] <sd-aidhex> <app-aidhex> <pem>[:pass]
sign-delete-token ๐๏ธ
This calculates a Delete Token using a private RSA or ECC key. Simple, clean, iconic.
Synopsis:
gpshell3 sign-delete-token [--output <file>] <aidhex> <pem>[:pass]
store ๐๏ธ
Personalize an application by combining INSTALL [for personalization] and STORE DATA. Itโs giving โtwo steps, one vibe.โ
Synopsis:
gpshell3 store [--encryption <noinfo|app|enc>] [--format <noinfo|dgi|ber>] [--response <true|false>] <AIDhex> <datahex>
Options:
--encryption(defaultnoinfo):noinfo: no encryption information;app: application-dependent encryption;enc: encrypted with data encryption key.
--format(defaultnoinfo):noinfo: raw data, no structural information;dgi: DGI structures;ber: BER-TLV structures.
--response <true|false>โ expect response data (defaultfalse).
store-iin ๐ข
Stores the Issuer Identification Number (tag 0x42) using BCD encoding. Cute little decimal string, big BCD energy.
Synopsis:
gpshell3 store-iin <IIN>
Options:
<IIN>โ Issuer Identification Number as a decimal string.
Example:
gpshell3 store-iin 123456
store-cin ๐
Stores the Card Image Number (tag 0x45) using BCD encoding. Same vibe, different tag.
Synopsis:
gpshell3 store-cin <CIN>
Options:
<CIN>โ Card Image Number as a decimal string.
Example:
gpshell3 store-cin 123456
card-data ๐
Reads a bundle of card data objects, in this exact order:
iin(Issuer Identification Number / SD Provider Identification Number, tag0x42)cin(Card Image Number / SD Image Number, tag0x45)CPLCcard-info(Card Recognition Data, tag0x66)card-cap(Card Capability Information, tag0x67)confirm-counter(tag0xC2)seq-counter(tag0xC1)div-data(Diversification Data, tag0xCF)
This command does not require authentication. No cap.
Example:
gpshell3 card-data
cplc ๐งฌ
Reads and decodes the Card Production Life Cycle (CPLC) data. This command does not require authentication.
Example:
gpshell3 cplc
iin ๐ชช
Reads Issuer Identification Number / SD Provider Identification Number (tag 0x42). This command does not require authentication.
Example:
gpshell3 iin
cin ๐ผ๏ธ
Reads Card Image Number / SD Image Number (tag 0x45). This command does not require authentication.
Example:
gpshell3 cin
scp11-cert-data ๐
Reads SCP11 authentication-related data:
- supported CA-KLOC identifiers (
GET DATA FF33), - supported CA-KLCC identifiers (
GET DATA FF34), - ECKA certificate store(s) (
GET DATA BF21) using key references (KID/KVN) discovered from supported CA-KLCC identifiers.
For each BF21 certificate store:
- GP legacy certificates (
7F21) are decoded per certificate usingGP211_parse_scp11_certificate. - X.509 DER certificate chains (
30) are printed as PEM.
The command first retrieves and prints supported CA identifiers. If no KLCC identifier is returned, ECKA certificate store retrieval is skipped. Thatโs the whole flow, bestie.
Synopsis:
gpshell3 [global-options] scp11-cert-data
This command does not require authentication.
Examples:
gpshell3 scp11-cert-data
scp11-store-cert ๐๏ธ
Stores or replaces an SCP11 certificate store (BF21) linked to a specific SK.SD.ECKA key reference (KID/KVN), using SCP11 section 7.8 encoding. Highkey specific.
Synopsis:
gpshell3 [global-options] scp11-store-cert --kv <ver> --idx <idx> <certificate-store-file>
Options:
--kv <ver>โ Key Version Number (KVN) of SK.SD.ECKA to link.--idx <idx>โ Key Identifier (KID) of SK.SD.ECKA to link.<certificate-store-file>โ File containing the certificate store value (BF21 value) or full BF21 TLV. X.509 certificates in DER and PEM form are supported, as are GP certificates.
Example:
gpshell3 --scp 3 --key 404142434445464748494A4B4C4D4E4F \
scp11-store-cert --kv 0x01 --idx 0x13 CERT.SD.ECKA.CHAIN.pem
scp11-store-ca-id ๐ชช
Stores or replaces a CA-KLOC Identifier mapping (CA Identifier -> PK.CA-KLOC.ECDSA KID/KVN) using SCP11 section 7.10 encoding. Mapping era, honestly.
Synopsis:
gpshell3 [global-options] scp11-store-ca-id --ca-id <hex> --kv <ver> --idx <idx>
Options:
--ca-id <hex>โ CA Identifier value (hex, variable length; commonly 20-byte SHA-1).--kv <ver>โ Key Version Number (KVN) of PK.CA-KLOC.ECDSA.--idx <idx>โ Key Identifier (KID) of PK.CA-KLOC.ECDSA.
Example:
gpshell3 --scp 3 --key 404142434445464748494A4B4C4D4E4F \
scp11-store-ca-id --ca-id CE5B7EABBC6828DD16133A5B008C3A3F185F8AE2 --kv 0x01 --idx 0x10
card-info โน๏ธ
Reads and decodes GlobalPlatform Card Recognition Data (Card Data tag 0x66). This command does not require authentication.
Example:
gpshell3 card-info
card-cap ๐งข
Reads and decodes GlobalPlatform Card Capability Information (Card Capability Information tag 0x67). This command does not require authentication.
Example:
gpshell3 card-cap
card-resources ๐
Reads extended card resource information (number of installed applications and free memory). This command does not require authentication.
Example:
gpshell3 card-resources
div-data ๐ฑ
Reads diversification data (tag 0xCF). This command does not require authentication.
Example:
gpshell3 div-data
seq-counter ๐ข
Reads the Sequence Counter of the default Secure Channel key set (tag 0xC1). This command does not require authentication.
Example:
gpshell3 seq-counter
confirm-counter โ
Reads the Confirmation Counter (tag 0xC2). This command does not require authentication.
Example:
gpshell3 confirm-counter
๐ PRIVILEGES ๐
Privileges are reported by list-apps as priv=[...] and can be supplied to install --priv as a comma-separated list of short names. Multiple privileges can be combined, e.g., --priv sd,cm-lock,trusted-path. Periodt.
sd,security-domainโ Application is a Security Domaindap-verif,dapโ Application can require DAP verification for loading and installing applicationsdelegated-mgmtโ Security Domain has delegated management rightcm-lockโ Application can lock the Card Managercm-terminateโ Application can terminate the carddefault-selected,card-resetโ Application is default selected (In GP 2.3.1 redefined as Card Reset privilege)pin-change,pinโ Application can change global PINmandated-dap,mandated-dap-verifโ Security Domain requires DAP verification for loading and installing applicationstrusted-pathโ Application is a Trusted Path for inter-application communicationauthorized-mgmtโ Application is capable of Card Content Management (Security Domain privilege shall also be set)token-verif,tokenโ Application is capable of verifying a token for Delegated Card Content Managementglobal-deleteโ Application may delete any Card Contentglobal-lockโ Application may lock or unlock any Applicationglobal-registryโ Application may access any entry in the GlobalPlatform Registryfinal-application,final-appโ The only Application selectable in card Life Cycle State CARD_LOCKED and TERMINATEDglobal-serviceโ Application provides services to other Applications on the cardreceipt-generation,receiptโ Application is capable of generating a receipt for Delegated Card Content Managementciphered-load-file-data-block,ciphered-loadโ The Security Domain requires that the Load File being associated with it is to be loaded cipheredcontactless-activationโ Application is capable of activating and deactivating any Application on the contactless interfacecontactless-self-activationโ Application is capable of activating itself on the contactless interface without a prior request to the Application with the Contactless Activation privilege
Note: Not all privileges are applicable to all element types. Refer to the GlobalPlatform Card Specification v2.3.1 for details. ๐
๐ COMMAND CHAINING ๐
Multiple commands can be executed in a single authenticated session by separating them with the keyword then. Global options (authentication, reader, etc.) are specified once before the first command. All chained commands share the same secure channel session. Itโs giving โone session, many moments.โ
This is essential when a command modifies the cardโs key store in a way that would prevent re-authentication. For example, on YubiKey 5 NFC, provisioning an SCP11 CA-KLOC key via put-key removes the SCP03 key set, making it impossible to re-authenticate in a separate invocation. By chaining put-key and scp11-store-ca-id with then, both operations complete within the session established before any key modifications. Obsessed with the foresight, honestly.
gpshell3 --scp 3 --kv 0xFF --key 404142434445464748494A4B4C4D4E4F \
put-key --type ecc --ecc-curve reference --kv 0 --idx 0x10 --new-kv 0x01 --pem ca.pem \
then scp11-store-ca-id --ca-id AABBCCDD --kv 0x01 --idx 0x10 \
then scp11-store-cert --kv 0x01 --idx 0x13 cert-store.bin
If any chained command fails, execution stops immediately (subsequent then commands are not run). No silent chaos.
โจ EXAMPLES โจ
Install an applet with parameters and explicit privileges:
gpshell3 install --priv default-selected --params 80 ./helloworld.cap
List applets and related:
gpshell3 list-apps
Store Issuer Identification Number:
gpshell3 store-iin 123456
Store Card Image Number:
gpshell3 store-cin 1234567890
Open APDU session with mutual auth and send GET DATA:
gpshell3 apdu --auth "80CA006600"
Put authentication keys:
put-auth --enc 404142434445464748494a4b4c4d4e4f --mac 404142434445464748494a4b4c4d4e4f --dek 404142434445464748494a4b4c4d4e4f
Compute CAP hash and sign DAP (AES):
HASH=$(gpshell3 hash ./helloworld.cap | tr -d '\n')
gpshell3 sign-dap aes --output dap.sig "$HASH" 00112233445566778899AABBCCDDEEFF
๐ช EXIT CODES ๐ช
0on success- non-zero on error (APDU errors produce non-zero unless
apdu --nostopis used)
โจ REQUIREMENTS โจ
okay so before you even think about running anything, bestie, you gotta have these two things lined up or it's giving nothing fr fr ๐ญ
- PC/SC stack and a compatible card reader ๐ณ โ like, the whole stack, not just a cute little USB thing you found in a drawer
- a GlobalPlatform-compliant card ๐ โ no random cards, she's gotta speak the language
no cap on this one: missing either of these and you're not getting past the vibe check ๐
๐ฆ SEE ALSO ๐ฆ
gpshell3(1)โ yes girl, that's this page, we love a self-reference moment ๐ซถ- GlobalPlatform Card Specification โ the iconic source material, go read it if you want the full lore iykyk ๐โจ
and that's the whole page, bestie!! you just read GPSHELL3(1), version 3.0.0 โ slay ๐ ๐ธ go forth and run some commands, you absolute main character ๐๐
๐ฆ where this page comes from
- nixpkgs unstable: globalplatform 3.0.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms