PIV-TOOL(1)
π PIV-TOOL(1) π
okay so bestie, welcome to piv-tool β a smart card utility for HSPD-12 PIV cards, straight out of the OpenSC Tools lineup. β¨
πΈ NAME πΈ
piv-tool β smart card utility for HSPD-12 PIV cards πͺͺ
β¨ SYNOPSIS β¨
piv-tool [OPTIONS]
The way that this works is that piv-tool is a command line utility you can use to do alllll the miscellaneous smart card operations on a HSPD-12 PIV smart card as defined in NIST 800-73-3. It is intended for use with test cards only. π
It can load objects, generate key pairs, and send arbitrary APDU commands to a card β but only after you've authenticated to the card using the card key provided by the card vendor. iykyk. π
π OPTIONS π
--serialβ Print the card serial number derived from the CHUID object, if any. Output is in hex byte format. β--name,-nβ Print the name of the inserted card (driver). π--admin argument,-A argumentβ Authenticate to the card using a 2DES, 3DES or AES key. The argument is of the form
{A|M}:ref:alg
and it is required, where A uses "EXTERNAL AUTHENTICATION" and M uses "MUTUAL AUTHENTICATION". ref is normally 9B, and alg is 03 for 3DES, 01 for 2DES, 08 for AES-128, 0A for AES-192 or 0C for AES-256. The key is provided by the card vendor. The environment variable PIV_EXT_AUTH_KEY must point to either a binary file matching the length of the key or a text file containing the key in the format:
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
--genkey argument,-G argumentβ Generate a key pair on the card and output the public key. The argument is of the form
ref:alg
and it is required, where ref is 9A, 9C, 9D or 9E and alg is 06, 07, 11 or 14 for RSA 1024, RSA 2048, ECC 256 or ECC 384 respectively. π₯
--object ContainerID,-O ContainerIDβ Load an object onto the card. The ContainerID is as defined in NIST 800-73-n without leading0x. Example: CHUID object is3000. π«Ά--cert ref,-C refβ Load a certificate onto the card.refis9A,9C,9Dor9E. π--compresscert ref,-Z refβ Load a certificate that has been gzipped onto the card.refis9A,9C,9Dor9E. π§--out file,-o fileβ Output file for any operation that produces output.--in file,-i fileβ Input file for any operation that requires an input file.--key-slots-discovery fileβ Print properties of the key slots. Needs 'admin' authentication. π--send-apdu apdu,-s apduβ Sends an arbitrary APDU to the card in the formatAA:BB:CC:DD:EE:FF....This option may be repeated. π¨--reader arg,-r argβ Number of the reader to use. By default, the first reader with a present card is used. Ifargis an ATR, the reader with a matching card will be chosen. π--wait,-wβ Wait for a card to be inserted. β³--verbose,-vβ Causespiv-toolto be more verbose. Specify this flag several times to enable debug output in the opensc library. π
π¦ SEE ALSO π¦
π AUTHORS π
piv-tool was written by Douglas E. Engert <deengert@gmail.com>. π
and that's the whole vibe check, bestie β no cap. π This page is from the opensc source, version-dated 04/19/2026, and it slayed. periodt. π β¨
π¦ where this page comes from
- fedora 43: opensc 0.27.1-2.fc43 Β· LGPL-2.1-or-later AND BSD-3-Clause
- fedora 44: opensc 0.27.1-2.fc44 Β· LGPL-2.1-or-later AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms