tpm2_checkquote(1)
๐ tpm2_checkquote(1) ๐
okay so this is tpm2_checkquote(1) from the General Commands Manual, and it is literally the vibe-check tool for TPM quotes. bestie, we are validating, not generating. slay. โจ
๐ธ NAME ๐ธ
tpm2_checkquote(1) โ Validates a quote provided by a TPM. periodt. ๐
โก SYNOPSIS โก
tpm2_checkquote [OPTIONS]
๐ DESCRIPTION ๐
tpm2_checkquote(1) uses the public portion of the key you hand it to validate a quote generated by a TPM. it will validate the signature against the quote message and, if you provide them, verify that the qualifying data and PCR values match those in the quote. no cap, this is the whole plot. ๐ซถ
the PCR values can be provided with or without the TPML_PCR_SELECTION information. an example of PCR values without the PCR selection information is the output from tpm2_pcrread. if a PCR value is specified without the PCR selection information, then the PCR selection string must be specified using the -l option to interpret the PCR data. iykyk, that -l is doing main character work. ๐
โจ OPTIONS โจ
-u,--public=FILEโ file input for the public portion of the signature verification key. either the pem file or tss public format file. ๐-g,--hash-algorithm=ALGORITHMโ the hash algorithm used to digest the message. ๐งฎ-m,--message=FILEโ the quote message that makes up the data that is signed by the TPM. ๐-s,--signature=FILEโ the input signature file of the signature to be validated. โ๏ธ-f,--pcr=FILEโ optional PCR input file to save the list of PCR values that were included in the quote. ๐งฌ-l,--pcr-list=PCRโ the list of PCR banks and selected PCRsโ ids for each bank. ๐ฆ-q,--qualification=HEX_STRING_OR_PATHโ qualification data for the quote. can either be a hex string or path. this is typically used to add a nonce against replay attacks. ๐ก๏ธ-F,--pcrs_format=FORMATโ format selection for the binary blob in the PCR output file.valueswill output a binary blob of the PCR values.serializedwill write or read a binary blob of the PCR values in the form of serialized data structure in little endian format.marshaledwill read or write a binary blob in the binary format used by the TSS2 marshaling and unmarshaling functions. ifmarshaledis used the data is serialized in the following order:TPML_PCR_SELECTION,UINT32(the number of followingTPML_DIGESTelements)TPML_DIGEST[number ofTPML_DIGESTelements]. optional. if-lis providednormalizedwill be used. otherwiseserializedis the default. ๐
๐ References ๐
the algorithm lore starts here, bestie ๐
๐งฌ Algorithm Specifiers ๐งฌ
options that take algorithms support โnice-namesโ.
there are two major algorithm specification string classes, simple and complex. only certain algorithms will be accepted by the TPM, based on usage and conditions. ๐ง
๐ Simple specifiers ๐
these are strings with no additional specification data. when creating objects, non-specified portions of an object are assumed to defaults. you can find the list of known โSimple Specifiersโ below. ๐ซ
๐ Asymmetric ๐
rsaecc
๐งธ Symmetric ๐งธ
aescamelliasm4
๐งฎ Hashing Algorithms ๐งฎ
sha1sha256sha384sha512sm3_256sha3_256sha3_384sha3_512
๐ซง Keyed Hash ๐ซง
hmacxor
โ๏ธ Signing Schemes โ๏ธ
rsassarsapssecdsaecdaaecschnorrsm2
๐ Asymmetric Encryption Schemes ๐
oaeprsaesecdh
๐ Modes ๐
ctrofbcbccfbecb
๐ฆ Misc ๐ฆ
null
๐งฉ Complex Specifiers ๐งฉ
objects, when specified for creation by the TPM, have numerous algorithms to populate in the public data. things like type, scheme and asymmetric details, key size, etc. below is the general format for specifying this data: <type>:<scheme>:<symmetric-details>. ๐
๐ท๏ธ Type Specifiers ๐ท๏ธ
this portion of the complex algorithm specifier is required. the remaining scheme and symmetric details will default based on the type specified and the type of the object being created.
aesโ default AES:aes128aes128<mode>โ 128 bit AES with optional mode (ctr|ofb|cbc|cfb|ecb). if mode is not specified, defaults tonull.aes192<mode>โ same asaes128<mode>, except for a 192 bit key size.aes256<mode>โ same asaes128<mode>, except for a 256 bit key size.sm4โ default SM4:sm4128sm4128orsm4_128 <mode>โ 128 bit SM4 with optional mode (ctr|ofb|cbc|cfb|ecb). if mode is not specified, defaults tonull.eccโ Elliptical Curve, defaults toecc256.ecc192orecc_nist_p192โ 192 bit ECC NIST curveecc224orecc_nist_p224โ 224 bit ECC NIST curveecc256orecc_nist_p256โ 256 bit ECC NIST curveecc384orecc_nist_p384โ 384 bit ECC NIST curveecc521orecc_nist_p521โ 521 bit ECC NIST curveecc_sm2orecc_sm2_p256โ 256 bit SM2 curversaโ default RSA:rsa2048rsa1024โ RSA with 1024 bit keysize.rsa2048โ RSA with 2048 bit keysize.rsa3072โ RSA with 3072 bit keysize.rsa4096โ RSA with 4096 bit keysize.
๐๏ธ Scheme Specifiers ๐๏ธ
next, is an optional field, it can be skipped.
schemes are usually Signing Schemes or Asymmetric Encryption Schemes. most signing schemes take a hash algorithm directly following the signing scheme. if the hash algorithm is missing, it defaults to sha256. some take no arguments, and some take multiple arguments. ๐
๐ธ Hash Optional Scheme Specifiers ๐ธ
these scheme specifiers are followed by a dash and a valid hash algorithm. for example: oaep-sha256.
oaepecdhrsassarsapssecdsaecschnorrsm2
๐ Multiple Option Scheme Specifiers ๐
ecdaaโ this scheme specifier is followed by a count (max sizeUINT16) then followed by a dash(-) and a valid hash algorithm. for example,ecdaa4-sha256. if no count is specified, it defaults to4.
๐ซ No Option Scheme Specifiers ๐ซ
rsaesโ this scheme specifier takes NO arguments.
๐งด Symmetric Details Specifiers ๐งด
this field is optional, and defaults based on the type of object being created and its attributes. generally, any valid Symmetric specifier from the Type Specifiers list should work. if not specified, an asymmetric objects symmetric details defaults to aes128cfb. โจ
๐ก Examples ๐ก
create an rsa2048 key with an rsaes asymmetric encryption scheme:
tpm2_create -C parent.ctx -G rsa2048:rsaes -u key.pub -r key.priv
create an ecc256 key with an ecdaa signing scheme with a count of 4 and sha384 hash:
/tpm2_create -C parent.ctx -G ecc256:ecdaa4-sha384 -u key.pub -r
key.priv cryptographic algorithms ALGORITHM.
and yes, the source also has the exact text cryptographic algorithms ALGORITHM. hanging out there, so it stays. ๐ญ
โ๏ธ Signature Format Specifiers โ๏ธ
format selection for the signature output file. tss (the default) will output a binary blob according to the TPM 2.0 specification and any potential compiler padding. the option plain will output the plain signature data as defined by the used cryptographic algorithm. signature FORMAT. ๐๏ธ
๐ ๏ธ COMMON OPTIONS ๐ ๏ธ
this collection of options are common to many programs and provide information that many users may expect. ๐ซถ
-h,--help=[man|no-man]โ display the tools manpage. by default, it attempts to invoke the manpager for the tool, however, on failure will output a short tool summary. this is the same behavior if the โmanโ option argument is specified, however if explicit โmanโ is requested, the tool will provide errors from man on stderr. if the โno-manโ option if specified, or the manpager fails, the short options will be output to stdout. to successfully use the manpages feature requires the manpages to be installed or onMANPATH, Seeman(1)for more details. ๐-v,--versionโ display version information for this tool, supported tctis and exit. ๐-V,--verboseโ increase the information that the tool prints to the console during its execution. when using this option the file and line number are printed. ๐-Q,--quietโ silence normal tool output to stdout. ๐คซ-Z,--enable-errataโ enable the application of errata fixups. useful if an errata fixup needs to be applied to commands sent to the TPM. defining the environmentTPM2TOOLS_ENABLE_ERRATAis equivalent. ๐ฉน-z,--pwd-sessionโ use password session instead of a HMAC session for authentication. a clear text password is passed to the TPM to authorize the action. this option can be used to avoid problems when unsalted sessions are used in OpenSSL FIPS mode. if auth values are used a salted session should be used for authentication. ๐-R,--autoflushโ enable autoflush for transient objects created by the command. if a parent object is loaded from a context file also the transient parent object will be flushed. autoflush can also be activated if the environment variableTPM2TOOLS_AUTOFLUSHis set toyesortrue. information many users may expect. ๐ฝ
๐ TCTI Configuration ๐
the TCTI or โTransmission Interfaceโ is the communication mechanism with the TPM. TCTIs can be changed for communication with TPMs across different mediums. ๐
to control the TCTI, the tools respect:
- the command line option
-Tor--tcti - the environment variable:
TPM2TOOLS_TCTI.
note: the command line option always overrides the environment variable. ๐ฏ
the current known TCTIs are:
tabrmdโ the resource manager, called tabrmd. note that tabrmd and abrmd as a tcti name are synonymous. ๐งmssimโ typically used for communicating to the TPM software simulator. ๐ฅ๏ธdeviceโ used when talking directly to a TPM device file. ๐งnoneโ do not initalize a connection with the TPM. some tools allow for off-tpm options and thus support not using a TCTI. tools that do not support it will error when attempted to be used without a TCTI connection. does not support ANY options and MUST BE presented as the exact text of โnoneโ. ๐ซ
the arguments to either the command line option or the environment variable are in the form:
<tcti-name>:<tcti-option-config>
specifying an empty string for either the <tcti-name> or <tcti-option-config> results in the default being used for that portion respectively. ๐
๐ TCTI Defaults ๐
when a TCTI is not specified, the default TCTI is searched for using dlopen(3) semantics. the tools will search for tabrmd, device and mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. you can query what TCTI will be chosen as the default by using the -v option to print the version information. the default-tcti key-value pair will indicate which of the aforementioned TCTIs is the default. ๐
๐ฆ Custom TCTIs ๐ฆ
any TCTI that implements the dynamic TCTI interface can be loaded. the tools internally use dlopen(3), and the raw tcti-name value is used for the lookup. thus, this could be a path to the shared library, or a library name as understood by dlopen(3) semantics. ๐ง
๐ซถ TCTI OPTIONS ๐ซถ
Okay so this lil' cluster of options is how you set up the various known TCTI modules that are out there โ think of it as picking which pipe your tool talks to the TPM through:
deviceโ for the device TCTI, you get to say exactly which TPM character device file the device TCTI should use. The default is/dev/tpm0, bestie, no notes.
Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=โdevice:/dev/tpm0โ
mssimโ for the mssim TCTI, you can specify the domain name or IP address and the port number that the simulator is using. The defaults are127.0.0.1and2321, iconic behaviour honestly.
Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TCTI=โmssim:host=localhost,port=2321โ
abrmdโ for the abrmd TCTI, the configuration string format is a whole series of simple key value pairs separated by a,character. Each key and value string are separated by a=character. Slay, very parseable.- The TCTI abrmd supports two keys, and yes there are exactly two:
bus_name: the name of the tabrmd service on the bus (a string).bus_type: the type of the dbus instance (a string) limited tosessionandsystem.
- The TCTI abrmd supports two keys, and yes there are exactly two:
Specify the tabrmd tcti name and a config string of bus_name=com.example.FooBar:
\--tcti=tabrmd:bus_name=com.example.FooBar
Specify the default (abrmd) tcti and a config string of bus_type=session:
\--tcti:bus_type=session
NOTE:abrmdandtabrmdare synonymous. the various known TCTI modules.
โจ EXAMPLES โจ
๐ Generate a quote with a TPM, then verify it
This is the whole main character arc right here โ make the quote, then vibe check it:
tpm2_createek -c 0x81010001 -G rsa -u ekpub.pem -f pem
tpm2_createak -C 0x81010001 -c ak.ctx -G rsa -s rsassa -g sha256 \
-u akpub.pem -f pem -n ak.name
tpm2_quote -c ak.ctx -l sha256:15,16,22 -q abc123 -m quote.msg -s quote.sig \
-o quote.pcrs -g sha256
tpm2_checkquote -u akpub.pem -m quote.msg -s quote.sig -f quote.pcrs -g sha256 \
-q abc123
๐ Returns ๐
Tools can return any of the following codes, and ngl you should lowkey memorise them:
0- Success. we love to see it ๐1- General non-specific error.2- Options handling error.3- Authentication error.4- TCTI related error.5- Non supported scheme. Applicable totpm2_testparams.
๐ BUGS ๐
Github Issues
๐ฆ HELP ๐ฆ
See the Mailing List
๐ License ๐
This work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
That's the whole page, bestie โ go forth and verify those quotes ๐
Signed, sealed, delivered: tpm2-tools, page tpm2_checkquote(1) โ that's the source and the version tag living right there in the footer, periodt. ๐
๐ฆ where this page comes from
- arch rolling: tpm2-tools 5.8-1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms