tpm2_policypassword(1)
π NAME π
okay so this is tpm2_policypassword(1) from the General Commands Manual, and it enables binding a policy to the authorization value of the authorized TPM object. that's the whole vibe, bestie π
β¨ SYNOPSIS β¨
tpm2_policypassword [OPTIONS]
π¦ DESCRIPTION π¦
tpm2_policypassword(1) enables a policy that requires the objectβs authentication passphrase be provided. itβs equivalent to authenticating using the object passphrase in plaintext, only this enforces it as a policy β¨
it provides a mechanism to allow for password authentication when an object only allows policy based authorization, ie object attribute βuserwithauthβ is 0. itβs giving βplaintext passphrase but make it policy,β and honestly? iconic π
π OPTIONS π
-L,--policy=FILEβ file to save the compounded policy digest. πΎ-S,--session=FILEβ the policy session file generated via the-Soption totpm2_startauthsession(1). π«Ά--cphash=FILEβ file path to record the hash of the command parameters. this is commonly termed as cpHash. NOTE: when this option is selected, The tool will not actually execute the command, it simply returns a cpHash. π
π References π
no references are listed here β just the heading, so weβre keeping it cute and empty β¨
π COMMON OPTIONS π
this collection of options are common to many programs and provide information that many users may expect. so basically: group-chat essentials for the tpm2 tools π
-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 is set toyesortrue. and the original literally follows that with βinformation many users may expect.β β keeping it, because every detail stays, even the mysterious ones π
π 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. periodt π
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 π‘
this collection of options are 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/tpm0orexport 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 default are127.0.0.1and2321. example:-T mssim:host=localhost,port=2321orexport 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. π»
- specify the tabrmd tcti name and a config string of
bus_name=com.example.FooBar:
- TCTI abrmd supports two keys:
\--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. and the original ends this whole area with the tiny fragment βthe various known TCTI modules.β β itβs staying, bestie π«Ά
π« EXAMPLES π«
we want to authenticate using the TPM objects plaintext authentication value. while we could authenticate with an ephemeral password session, in this example we will authenticate with the plaintext passphrase in a policy session instead using the tpm2_policypassword(1) tool. letβs gooo π₯
π Create the password policy
tpm2_startauthsession -S session.dat
tpm2_policypassword -S session.dat -L policy.dat
tpm2_flushcontext session.dat
π§Έ Create the object with a passphrase and the password policy
tpm2_createprimary -C o -c prim.ctx
tpm2_create -g sha256 -G aes -u key.pub -r key.priv -C prim.ctx -L policy.dat \
-p testpswd
π Authenticate with plaintext passphrase input
tpm2_load -C prim.ctx -u key.pub -r key.priv -n key.name -c key.ctx
echo "plaintext" > plain.txt
tpm2_encryptdecrypt -c key.ctx -o encrypt.out plain.txt -p testpswd plain.txt
ποΈ Authenticate with password and the policy
tpm2_startauthsession \--policy-session -S session.dat
tpm2_policypassword -S session.dat -L policy.dat
tpm2_encryptdecrypt -c key.ctx -o encrypt.out \
-p session:session.dat+testpswd plain.txt
tpm2_flushcontext session.dat
π₯ 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, plan accordingly bestie π«Ά
π 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). π
xoxo, from tpm2-tools β the tpm2_policypassword(1) manual page. the footer didnβt print a date, so iβm not making one up, bestie π
π
π¦ 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