1tpm2_policypassword(1) General Commands Manual tpm2_policypassword(1)
2
3
4
6 tpm2_policypassword(1) - Enables binding a policy to the authorization
7 value of the authorized TPM object.
8
10 tpm2_policypassword [OPTIONS]
11
13 tpm2_policypassword(1) - Enables a policy that requires the object’s
14 authentication passphrase be provided. This is equivalent to authenti‐
15 cating using the object passphrase in plaintext, only this enforces it
16 as a policy. It provides a mechanism to allow for password authentica‐
17 tion when an object only allows policy based authorization, ie object
18 attribute “userwithauth” is 0.
19
21 • -L, --policy=FILE:
22
23 File to save the compounded policy digest.
24
25 • -S, --session=FILE:
26
27 The policy session file generated via the -S option to tpm2_star‐
28 tauthsession(1).
29
30 References
32 This collection of options are common to many programs and provide in‐
33 formation that many users may expect.
34
35 • -h, --help=[man|no-man]: Display the tools manpage. By default, it
36 attempts to invoke the manpager for the tool, however, on failure
37 will output a short tool summary. This is the same behavior if the
38 “man” option argument is specified, however if explicit “man” is re‐
39 quested, the tool will provide errors from man on stderr. If the
40 “no-man” option if specified, or the manpager fails, the short op‐
41 tions will be output to stdout.
42
43 To successfully use the manpages feature requires the manpages to be
44 installed or on MANPATH, See man(1) for more details.
45
46 • -v, --version: Display version information for this tool, supported
47 tctis and exit.
48
49 • -V, --verbose: Increase the information that the tool prints to the
50 console during its execution. When using this option the file and
51 line number are printed.
52
53 • -Q, --quiet: Silence normal tool output to stdout.
54
55 • -Z, --enable-errata: Enable the application of errata fixups. Useful
56 if an errata fixup needs to be applied to commands sent to the TPM.
57 Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent. in‐
58 formation many users may expect.
59
61 The TCTI or “Transmission Interface” is the communication mechanism
62 with the TPM. TCTIs can be changed for communication with TPMs across
63 different mediums.
64
65 To control the TCTI, the tools respect:
66
67 1. The command line option -T or --tcti
68
69 2. The environment variable: TPM2TOOLS_TCTI.
70
71 Note: The command line option always overrides the environment vari‐
72 able.
73
74 The current known TCTIs are:
75
76 • tabrmd - The resource manager, called tabrmd
77 (https://github.com/tpm2-software/tpm2-abrmd). Note that tabrmd and
78 abrmd as a tcti name are synonymous.
79
80 • mssim - Typically used for communicating to the TPM software simula‐
81 tor.
82
83 • device - Used when talking directly to a TPM device file.
84
85 • none - Do not initalize a connection with the TPM. Some tools allow
86 for off-tpm options and thus support not using a TCTI. Tools that do
87 not support it will error when attempted to be used without a TCTI
88 connection. Does not support ANY options and MUST BE presented as
89 the exact text of “none”.
90
91 The arguments to either the command line option or the environment
92 variable are in the form:
93
94 <tcti-name>:<tcti-option-config>
95
96 Specifying an empty string for either the <tcti-name> or <tcti-op‐
97 tion-config> results in the default being used for that portion respec‐
98 tively.
99
100 TCTI Defaults
101 When a TCTI is not specified, the default TCTI is searched for using
102 dlopen(3) semantics. The tools will search for tabrmd, device and
103 mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query
104 what TCTI will be chosen as the default by using the -v option to print
105 the version information. The “default-tcti” key-value pair will indi‐
106 cate which of the aforementioned TCTIs is the default.
107
108 Custom TCTIs
109 Any TCTI that implements the dynamic TCTI interface can be loaded. The
110 tools internally use dlopen(3), and the raw tcti-name value is used for
111 the lookup. Thus, this could be a path to the shared library, or a li‐
112 brary name as understood by dlopen(3) semantics.
113
115 This collection of options are used to configure the various known TCTI
116 modules available:
117
118 • device: For the device TCTI, the TPM character device file for use by
119 the device TCTI can be specified. The default is /dev/tpm0.
120
121 Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“de‐
122 vice:/dev/tpm0”
123
124 • mssim: For the mssim TCTI, the domain name or IP address and port
125 number used by the simulator can be specified. The default are
126 127.0.0.1 and 2321.
127
128 Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TC‐
129 TI=“mssim:host=localhost,port=2321”
130
131 • abrmd: For the abrmd TCTI, the configuration string format is a se‐
132 ries of simple key value pairs separated by a `,' character. Each
133 key and value string are separated by a `=' character.
134
135 • TCTI abrmd supports two keys:
136
137 1. `bus_name' : The name of the tabrmd service on the bus (a
138 string).
139
140 2. `bus_type' : The type of the dbus instance (a string) limited to
141 `session' and `system'.
142
143 Specify the tabrmd tcti name and a config string of bus_name=com.ex‐
144 ample.FooBar:
145
146 \--tcti=tabrmd:bus_name=com.example.FooBar
147
148 Specify the default (abrmd) tcti and a config string of bus_type=ses‐
149 sion:
150
151 \--tcti:bus_type=session
152
153 NOTE: abrmd and tabrmd are synonymous. the various known TCTI mod‐
154 ules.
155
157 We want to authenticate using the TPM objects plaintext authentication
158 value. While we could authenticate with an ephemeral password session,
159 in this example we will authenticate with the plaintext passphrase in a
160 policy session instead using the tpm2_policypassword(1) tool.
161
162 Create the password policy
163 tpm2_startauthsession -S session.dat
164
165 tpm2_policypassword -S session.dat -L policy.dat
166
167 tpm2_flushcontext session.dat
168
169 Create the object with a passphrase and the password policy
170 tpm2_createprimary -C o -c prim.ctx
171
172 tpm2_create -g sha256 -G aes -u key.pub -r key.priv -C prim.ctx -L policy.dat \
173 -p testpswd
174
175 Authenticate with plaintext passphrase input
176 tpm2_load -C prim.ctx -u key.pub -r key.priv -n key.name -c key.ctx
177
178 echo "plaintext" > plain.txt
179 tpm2_encryptdecrypt -c key.ctx -o encrypt.out plain.txt -p testpswd plain.txt
180
181 Authenticate with password and the policy
182 tpm2_startauthsession \--policy-session -S session.dat
183
184 tpm2_policypassword -S session.dat -L policy.dat
185
186 tpm2_encryptdecrypt -c key.ctx -o encrypt.out \
187 -p session:session.dat+testpswd plain.txt
188
189 tpm2_flushcontext session.dat
190
192 Tools can return any of the following codes:
193
194 • 0 - Success.
195
196 • 1 - General non-specific error.
197
198 • 2 - Options handling error.
199
200 • 3 - Authentication error.
201
202 • 4 - TCTI related error.
203
204 • 5 - Non supported scheme. Applicable to tpm2_testparams.
205
207 It expects a session to be already established via tpm2_startauthses‐
208 sion(1) and requires one of the following:
209
210 • direct device access
211
212 • extended session support with tpm2-abrmd.
213
214 Without it, most resource managers will not save session state between
215 command invocations.
216
218 Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
219
221 See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
222
223
224
225tpm2-tools tpm2_policypassword(1)