Linux command
tpm2 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List all available
tpm2 --help
Get 8 random bytes
tpm2 getrandom 8 | xxd -p
Initialize the TPM
tpm2 startup -c
Read PCR values
tpm2 pcrread sha256:all
Extend a PCR
tpm2 pcrextend [index]:sha256=[hexdigest]
Reset a resettable PCR
tpm2 pcrreset [index]
Create a primary key
tpm2 createprimary -C o -c primary.ctx
Use a specific TCTI
tpm2 --tcti=mssim getrandom 8
说明
tpm2 is a single busybox-style executable that combines all of the individual tpm2-tools utilities into one binary. Each historical tool, such as tpm2_getrandom or tpm2_pcrread, is available as a subcommand of tpm2 (invoke tpm2 getrandom) as well as through a symlink of the original name. The dispatcher exists primarily to shrink the footprint of tpm2-tools on size-constrained systems (initramfs images, embedded devices, recovery environments) where shipping dozens of separate binaries is wasteful. Because each _tpm2_<tool>_ symlink points back to the same binary, behaviour is identical between the two invocation styles. Tools cover the full TPM 2.0 command surface: key creation and loading, NV storage, PCR operations, session and policy management, attestation, and auditing.
FAQ
What is the tpm2 command used for?
tpm2 is a single busybox-style executable that combines all of the individual tpm2-tools utilities into one binary. Each historical tool, such as tpm2_getrandom or tpm2_pcrread, is available as a subcommand of tpm2 (invoke tpm2 getrandom) as well as through a symlink of the original name. The dispatcher exists primarily to shrink the footprint of tpm2-tools on size-constrained systems (initramfs images, embedded devices, recovery environments) where shipping dozens of separate binaries is wasteful. Because each _tpm2_<tool>_ symlink points back to the same binary, behaviour is identical between the two invocation styles. Tools cover the full TPM 2.0 command surface: key creation and loading, NV storage, PCR operations, session and policy management, attestation, and auditing.
How do I run a basic tpm2 example?
Run `tpm2 --help` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more tpm2 examples?
This page includes 8 examples for tpm2, plus related commands for nearby Linux tasks.