keycard is a command line tool to manage Status Keycards — programmable NFC/USB hardware wallets for Ethereum and other cryptographic operations.
- A USB smart card reader (contact readers are more reliable than NFC readers).
- On Linux, install and run the PC/SC daemon.
Download the pre-built binary for your platform from the releases page and rename the file to keycard, removing the platform-specific suffix.
make build
./build/bin/keycard --helpTo run tests:
make testThe following flags are available on all commands:
| Flag | Description |
|---|---|
--log-level <level> |
Log level: debug, info, warn, error (default: info) |
--pin <pin> |
PIN for card authentication (or KEYCARD_PIN env var) |
--puk <puk> |
PUK for card unblocking (or KEYCARD_PUK env var) |
--pairing-password <pw> |
Pairing password for V1 cards (or KEYCARD_PAIRING_PASSWORD env var) |
--reader <name> |
Specific reader name to use (auto-detect if omitted) |
--json / -j |
Output in JSON format |
--yes / -y |
Skip interactive confirmations |
--card-ca <hex> |
CA public key for V2 certificate verification (hex, 33 bytes compressed) |
--test-card |
Shortcut for --card-ca with the test CA public key |
--whitelist-card <hex> |
Whitelisted card identity public key (hex, 33 bytes compressed) |
--show-secrets |
Show secrets (PIN, PUK, pairing keys) in output. Hidden by default |
| Variable | Description |
|---|---|
KEYCARD_PIN |
Default PIN for card authentication |
KEYCARD_PUK |
Default PUK for card unblocking |
KEYCARD_PAIRING_PASSWORD |
Default pairing password for V1 cards |
Show the CLI version.
keycard versionShow card information (applet version, initialization status, public key, etc.).
keycard info
keycard info --jsonInstall applets to the card. Download the cap file from the keycard-tech/status-keycard releases page.
keycard install --applet-file PATH_TO_CAP_FILEBy default, the keycard and ident applets are installed. Control which applets get installed:
| Flag | Default | Description |
|---|---|---|
--keycard-applet |
true |
Install keycard applet |
--ident-applet |
true |
Install ident applet |
--cash-applet |
false |
Install cash applet |
--ndef-applet |
false |
Install NDEF applet |
--force / -f |
Force reinstallation if already installed | |
--ndef <url> |
URL for the NDEF record (supports {{.cashAddress}} variable) |
keycard delete --yesInitialize the card and generate the secrets needed for authentication.
keycard initOptions:
| Flag | Description |
|---|---|
--pin <pin> |
Set a specific PIN (random if omitted) |
--puk <puk> |
Set a specific PUK (random if omitted) |
--pairing-password <pw> |
Set pairing password (V1 only, random if omitted) |
--alt-pin <pin> |
Set alternative PIN (random if omitted) |
--pin-retries <n> |
Number of PIN retries allowed (default: 3) |
--puk-retries <n> |
Number of PUK retries allowed (default: 5) |
On V2 cards (Secure Channel V2), the pairing password is not used.
keycard factory-reset --yesPairing is only needed for applet versions < 4.0 (Secure Channel V1). V2 cards use certificate-based authentication.
Pair with the card to establish a secure channel.
keycard pair --pairing-password YOUR_PAIRING_PASSWORDUnpair a specific pairing index.
keycard unpair --index 0 --pin YOUR_PINRemove all other pairings (keep current session).
keycard unpair-all --pin YOUR_PINGenerate a new random key on the card.
keycard generate-key --pin YOUR_PINGenerate a BIP39 mnemonic phrase using the card's secure RNG. The phrase is returned but not loaded by default. Use --save to also load the mnemonic's seed onto the card.
keycard generate-mnemonic --words 12 # Generate only (no PIN needed)
keycard generate-mnemonic --words 24 --save --pin YOUR_PIN # Generate and load onto card| Flag | Default | Description |
|---|---|---|
--words <n> |
12 |
Number of words: 12, 15, 18, 21, or 24 |
--save |
Also load the mnemonic's binary seed onto the card (requires PIN) |
Remove the current key from the card.
keycard remove-key --pin YOUR_PINLoad a BIP39 seed onto the card.
keycard load-seed --mnemonic "word1 word2 ... word12" --pin YOUR_PIN
keycard load-seed --hex "0x..." --pin YOUR_PINLoad a seed for usage with the LEE (Logos Execution Environment) onto the card (applet >= 4.0 only).
keycard load-lee-seed --mnemonic "word1 word2 ... word12" --pin YOUR_PINExport the public key.
keycard export-public-key --path "m/44'/60'/0'/0/0" --pin YOUR_PINExport the private key. Only works for paths in the EIP-1581 tree.
keycard export-private-key --path "m/43'/60'/1581'/4'/1469833213'/1555737549" --pin YOUR_PINExport the extended key (public key + chain code).
keycard export-extended-key --path "m/44'/60'/0'/0/0" --pin YOUR_PINExport a LEE key at the given path (applet >= 4.0 only).
keycard export-lee-key --path "m/44'/60'/0'/0/0" --pin YOUR_PINExport a BIP85 derived key (applet >= 4.0 only).
keycard export-bip85 --path "m/83696968'/39'/0'/12'/0'" --length 16 --pin YOUR_PINSign a 32-byte hash.
keycard sign --hex "0x..." --path "m/44'/60'/0'/0/0" --algo ecdsa --pin YOUR_PIN
keycard sign --hex "0x..." --path "m/44'/60'/0'/0/0" --algo schnorr --pin YOUR_PINSign a message using the Ethereum Signed Message format.
keycard sign-message "Hello, Keycard!" --path "m/44'/60'/0'/0/0" --pin YOUR_PINSign a file (hashes the file content with Keccak256).
keycard sign-file --file /path/to/file --path "m/44'/60'/0'/0/0" --pin YOUR_PINVerify the PIN.
keycard verify-pin --pin YOUR_PINChange the PIN.
keycard change-pin --new NEW_PIN --pin YOUR_PINChange the PUK.
keycard change-puk --new NEW_PUK --pin YOUR_PINUnblock the PIN using the PUK.
keycard unblock-pin --puk YOUR_PUK --new-pin NEW_PINChange the pairing password (applet < 4.0 only).
keycard change-pairing-password --new NEW_PASSWORD --pin YOUR_PINRead data from the card.
keycard get-data --type public
keycard get-data --type ndef
keycard get-data --type cashStore data on the card.
keycard store-data --type public --hex "0x..." --pin YOUR_PIN
keycard store-data --type public --file /path/to/data --pin YOUR_PINGet a random challenge from the card (applet >= 4.0 only).
keycard get-challenge --length 32Set the NDEF record on the card.
keycard set-ndef --hex "0x..." --pin YOUR_PIN
keycard set-ndef --file /path/to/ndef --pin YOUR_PINGet card status (PIN retries, key path, etc.).
keycard get-statusGet the card's display name.
keycard get-nameSet the card's display name.
keycard set-name --name "My Keycard" --pin YOUR_PINShow Cash applet information.
keycard cash-infoSign data using the Cash applet.
keycard cash-sign --hex "0x..."Load an identity certificate onto the Ident applet.
keycard load-ident --hex "0x..."
keycard load-ident --testStart an interactive shell or run a script file for batch operations.
# Interactive shell
keycard shell
# Run a script file
keycard shell -f script.sh
# Pipe commands from stdin
echo "info" | keycard shell
# JSON output (JSONL)
keycard shell -f script.sh --jsonThe shell supports template functions like {{env "KEYCARD_PIN"}}, {{session_pairing_key}}, {{session_pin}}, etc. See the _shell-commands-examples directory for examples.