tpm2_policyauthorize(1)
π
tpm2_policyauthorize(1) β General Commands Manual, bestie edition π
πΈ NAME πΈ
tpm2_policyauthorize(1) β allows for mutable policies by tethering to a signing authority. Thatβs the whole assignment, no cap. π
β¨ SYNOPSIS β¨
tpm2_policyauthorize [OPTIONS]
π¦ DESCRIPTION π¦
tpm2_policyauthorize(1) is literally how policies get to change: you associate the policy with a signing authority and let the policy contents change. Iconic behavior. π
- If the input session is a trial session, this tool generates a policy digest that associates a signing authorityβs public key name with the policy being authorized. So the name + policy are tethered together, slay. π
- If the input session is a real policy session,
tpm2_policyauthorize(1)looks for a verification ticket from the TPM to attest that the TPM has verified the signature on the policy digest before authorizing the policy in the policy digest. Basically: ticket says the TPM checked the signature, and then we authorize. ποΈ
π OPTIONS π
-L,--policy=FILEβ file to save the policy digest. πΎ-S,--session=FILEβ the policy session file generated via the-Soption totpm2_startauthsession(1). ποΈ-i,--input=FILEβ the policy digest that has to be authorized. This is the digest in question, bestie. π-q,--qualification=FILE_OR_HEXβ the policy qualifier data signed in conjunction with the input policy digest. Itβs unique data that the signer can choose to include in the signature, and it can either be a path or a hex string. π§Ύβ¨-n,--name=FILEβ file containing the name of the verifying public key. This ties the final policy digest with a signer. You can get this withtpm2_readpublic(1). π-t,--ticket=FILEβ the ticket file to record the validation structure. This is generated withtpm2_verifysignature(1). π«--cphash=FILEβ file path to record the hash of the command parameters. This is commonly termedcpHash.
NOTE: when this option is selected, the tool will not actually execute the command, it simply returns a cpHash. So donβt expect the command to run, bestie. π«Ά
π References π
The original page has this References heading right here with no extra reference entries listed under it, so Iβm not inventing any links. Heading present, chaos preserved. π
π COMMON OPTIONS π
This collection of options is common to many programs and provides information that many users may expect. Group-chat classics, basically. π¬
-h,--help=[man|no-man]β display the toolβs manpage. By default it attempts to invoke the manpager for the tool, but on failure it will output a short tool summary. Same behavior if themanoption argument is specified. However, if explicitmanis requested, the tool will provide errors from man on stderr. If theno-manoption is 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 on MANPATH. See man(1) for more details. π
-v,--versionβ display version information for this tool, supported tctis and exit. Version check, then bye. π-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. Shhh era. π€«-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 is set toyesortrue.
Also yes, the original bullet has the stray trailing phrase information many users may expect. at the end β keeping that little chaos goblin for the record. ππ
π‘ 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 thattabrmdandabrmdas 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 π
This collection of options is used to configure the various known TCTI modules available:
device: for the device TCTI, the TPM character device file for use by the device TCTI can be specified. The default is/dev/tpm0.
Example: -T device:/dev/tpm0 or export:
export TPM2TOOLS_TCTI=βdevice:/dev/tpm0β
mssim: for the mssim TCTI, the domain name or IP address and port number used by the simulator can be specified. The defaults are127.0.0.1and2321.
Example: -T mssim:host=localhost,port=2321 or export:
export TPM2TOOLS_TCTI=βmssim:host=localhost,port=2321β
abrmd: for the abrmd TCTI, the configuration string format is a series of simple key value pairs separated by a,character. Each key and value string are separated by a=character.- TCTI abrmd supports two keys:
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.
- TCTI abrmd supports two keys:
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. Also, the original page has the trailing phrasethe various known TCTI modules.right there β keeping it for the record. π
π EXAMPLES π
Starts a trial session, builds a PCR policy. This PCR policy digest is then an input to tpm2_policyauthorize(1) along with policy qualifier data and a signer public. The resultant policy digest is then used in creation of objects. π§±
Subsequently, when the PCR changes and so does the PCR policy digest, the actual policy digest from tpm2_policyauthorize(1) used in creation of the object will not change. At runtime the new PCR policy needs to be satisfied along with verification of the signature on the PCR policy digest using tpm2_policyauthorize(1). πβ¨
π Create a signing authority π
openssl genrsa -out signing_key_private.pem 2048
openssl rsa -in signing_key_private.pem -out signing_key_public.pem -pubout
tpm2_loadexternal -G rsa -C o -u signing_key_public.pem -c signing_key.ctx -n signing_key.name
ποΈ Create the authorize policy digest ποΈ
tpm2_startauthsession -S session.ctx
tpm2_policyauthorize -S session.ctx -L authorized.policy -n signing_key.name
tpm2_flushcontext session.ctx
π§ͺ Create a policy to be authorized like a PCR policy π§ͺ
tpm2_pcrread -opcr0.sha256 sha256:0
tpm2_startauthsession -S session.ctx
tpm2_policypcr -S session.ctx -l sha256:0 -f pcr0.sha256 -L pcr.policy_desired
tpm2_flushcontext session.ctx
βοΈ Sign the policy βοΈ
openssl dgst -sha256 -sign signing_key_private.pem -out pcr.signature pcr.policy_desired
π§° Create a TPM object like a sealing object with the authorized policy based authentication π§°
tpm2_createprimary -C o -g sha256 -G rsa -c prim.ctx
tpm2_create -g sha256 -u sealing_pubkey.pub -r sealing_prikey.pub -i- -C prim.ctx -L authorized.policy <<< "secret to seal"
π Verify the desired policy digest comes from the signing authority, read the actual value of PCR and check that read policy and desired policy are equal π
tpm2_verifysignature -c signing_key.ctx -g sha256 -m pcr.policy_desired -s pcr.signature -t verification.tkt -f rsassa
tpm2_startauthsession \--policy-session -S session.ctx
tpm2_policypcr -S session.ctx -l sha256:0 -L pcr.policy_read
tpm2_policyauthorize -S session.ctx -L authorized.policy -i pcr.policy_desired -n signing_key.name -t verification.tkt
tpm2_load -C prim.ctx -u sealing_pubkey.pub -r sealing_prikey.pub -c sealing_key.ctx
unsealed=$(tpm2_unseal -p"session:session.ctx" -c sealing_key.ctx)
echo $unsealed
tpm2_flushcontext session.ctx
π― Returns π―
Tools can return any of the following codes:
0β Success. π1β General non-specific error.2β Options handling error.3β Authentication error.4β TCTI related error.5β Non supported scheme. Applicable totpm2_testparams.
π§ Limitations π§
It expects a session to be already established via tpm2_startauthsession(1) and requires one of the following:
- direct device access
- extended session support with
tpm2-abrmd.
Without it, most resource managers will not save session state between command invocations. So yeah, session state is not gonna magically persist. π¬
π BUGS π
Github Issues. Thatβs the bug-report vibe. π
π£ HELP π£
See the Mailing List. π¬
π License π
This work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). π
Cute sign-off: this iconic page is from tpm2-tools, for tpm2_policyauthorize(1), and the footer has no date β so Iβm not inventing one. Mwah ππ
π¦ 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