tpm2-totp(1)
β¨ NAME β¨
tpm2-totp(1) β initialize or calculate and show TPM based TOTPs. hiiii bestie, you're reading the tpm2-totp(1) page from the General Commands Manual, and it's giving secure lil authenticator energy π«Ά
π¦ SYNOPSIS π¦
tpm2-totp [options]
π DESCRIPTION π
Okay so here's the vibe: tpm2-totp creates a key inside a TPM 2.0 that can be used to calculate time-based onetime passwords (TOTPs). The whole point is to demonstrate to the user that a platform was not altered during their absence and is therefore still trustworthy β¨
π ARGUMENTS π
The tpm2-totp command expects one of five commands and gives you a set of options too π
π COMMANDS π
initβ Generate and store a new TOTP secret. Possible options:-b,-l,-N,-p,-P,-T,-sshowβ Calculate and show a TOTP value. Possible options:-N,-t,-Tresealβ Reseal TOTP secret to new PCRs, banks or values. Possible options:-b,-N,-p,-P(required),-Trecoverβ Recover the TOTP secret and display it again. Possible Options:-N,-P(required),-Tcleanβ Delete the consumed NV index. Possible Options:-N,-T
π OPTIONS π
-b <bank>[,<bank>[,...]],--banks <bank>[,<bank>[,...]]β Selected PCR banks. Default:SHA1,SHA256-h,--helpβ Print help-l,--labelβ Label to use for display in the TOTP authenticator app. Default:TPM2-TOTP-s,--secretβ Specify a custom secret instead of randomly generating one-N <nvindex>,--nvindex <nvindex>β TPM NV index to store data. Default:0x018094AF-p <pcr>[,<pcr>[,...]],--pcrs <pcr>[,<pcr>[,...]]β Selected PCR registers. Default:0,2,4,6-P <password>,--password <password>β Password for the secret. Default:none(commands:init,recover,reseal). Read from stdin if-(recommended). Must not contain\0.-t,--timeβ Display the date/time of the TOTP calculation (commands:show)-T <tcti-name>[:<tcti-config>],--tcti <tcti-name>[:<tcti-config>]β Select the TCTI to use.tcti-nameis the name of the TCTI library. If present, the configuration stringtcti-configis passed verbatim to the chosen TCTI library. The TCTI can additionally be specified using the environment variableTPM2TOTP_TCTI. If both the command line option and the environment variable are present, the command line option is used. If no TCTI is specified, the default TCTI configured on the system is used.-v,--verboseβ Print verbose messages
πΈ EXAMPLES πΈ
β¨ Setup β¨
The TOTP secret can be initialized with and without password. It is recommended to set a password -P in order to enable recovery options. Further, it is strongly recommended to provide the password via stdin, rather than directly as a command line option, to protect it from other processes, shell history, etc. Also the PCRs and PCR banks can be selected -p and -b. Default values are PCRs 0,2,4 and banks SHA1, SHA256.
tpm2-totp init
tpm2-totp -P - init
verysecret<CTRL-D>
# or (recommended)
gpg --decrypt /path/to/password.gpg | tpm2-totp -P - init
# or (discouraged)
tpm2-totp -P verysecret init
tpm2-totp -P - -p 0,1,2,3,4,5,6 init
tpm2-totp -p 0,1,2,3,4,5,6 -b SHA1,SHA256 init
β οΈ bestie, that tpm2-totp -P verysecret init line is literally marked discouraged in the page π use stdin if you can.
π Boot π
During boot the TOTP value for the current time, together with the current time, should be shown to the user, e.g. using plymouth from mkinitrd or from dracut. The command to be executed is:
tpm2-totp show
tpm2-totp -t show
π Recovery π
In order to recover the QR code:
tpm2-totp -P - recover
In order to reseal the secret:
tpm2-totp -P - reseal
tpm2-totp -P - -p 1,3,5,6 reseal
π¦ Deletion π¦
In order to delete the created NV index:
tpm2-totp clean
π NV index π
All commands additionally take the -N option to specify the NV index to be used. By default, 0x018094AF is used and recommended.
tpm2-totp -N 0x01800001 -P - init
tpm2-totp -N 0x01800001 show
tpm2-totp -N 0x01800001 -P - recover
tpm2-totp -N 0x01800001 -P - reseal
π TCTI configuration π
All commands take the -T option or the TPM2TOTP_TCTI environment variable to specify the TCTI to be used. If the TCTI is not specified explicitly, the default TCTI configured on the system is used. To e.g. use the TPM simulator bound to a given port, use:
tpm2-totp -T mssim:port=2321 init
β RETURNS β
0 on success or 1 on failure.
π AUTHOR π
Written by Andreas Fuchs.
π COPYRIGHT π
tpm2tss is Copyright (C) 2018 Fraunhofer SIT. License BSD 3-clause.
π SEE ALSO π
tpm2totp_generateKey(3)
π cute lil sign-off: this page is source/versiontpm2-totp, datedDECEMBER 2018, and it'stpm2-totp(1)β mwah, bestie, go be trustworthy and slay π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: tpm2-totp 20240326.33e1986-bp160.1.3 Β· BSD-3-Clause
- opensuse-leap 16.0: tpm2-totp 20240326.33e1986-bp160.1.3 Β· BSD-3-Clause
- opensuse-leap 16.0: tpm2-totp 20240326.33e1986-bp160.1.3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms