1tpm2_policysecret(1)        General Commands Manual       tpm2_policysecret(1)
2
3
4

NAME

6       tpm2_policysecret(1)  -  Couples the authorization of an object to that
7       of an existing object.
8

SYNOPSIS

10       tpm2_policysecret [OPTIONS] [ARGUMENT]
11

DESCRIPTION

13       tpm2_policysecret(1) - Couples the authorization of an object  to  that
14       of  an  existing  object without requiring exposing the existing secret
15       until time of object use.
16

OPTIONS

18       · -c, --object-context=OBJECT:
19
20         A context object specifier of  a  transient/permanent/persistent  ob‐
21         ject.   Either  a file path of a object context blob or a loaded/per‐
22         sistent/permanent handle id.  See section  "Context  Object  Format".
23         As an argument, it takes the auth value of the associated TPM object,
24         a single dash - can be used to read the auth value from  stdin.   The
25         argument  follows  the "authorization formatting standards", see sec‐
26         tion "Authorization Formatting".
27
28       · -S, --session=FILE:
29
30         The policy session file generated via the  -S  option  to  tpm2_star‐
31         tauthsession(1).
32
33       · -L, --policy=FILE:
34
35         File to save the policy digest.
36
37       · -t, --expiration=NATURAL_NUMBER:
38
39         Set the expiration time of the policy in seconds.  In absence of non‐
40         ceTPM the expiration time is the policy timeout value.  If expiration
41         value  is  0 then the policy does not have a time limit on the autho‐
42         rization.
43
44       · --ticket=FILE:
45
46         The ticket file to record the authorization ticket structure.
47
48       · --timeout=FILE:
49
50         The file path to record the timeout structure returned.
51
52       · -x, --nonce-tpm:
53
54         Enable the comparison of the current session's nonceTPM to ensure the
55         validity  of  the policy authorization is limited to the current ses‐
56         sion.
57
58       · -q, --qualification=FILE_OR_HEX_STR:
59
60         Optional, the policy qualifier data that the signer can choose to in‐
61         clude in the signature.  Can be either a hex string or path.
62
63       · ARGUMENT  the  command line argument specifies the AUTH to be set for
64         the object specified with -c.
65
66   References

Context Object Format

68       The type of a context object, whether it is a handle or file  name,  is
69       determined according to the following logic in-order:
70
71       · If the argument is a file path, then the file is loaded as a restored
72         TPM transient object.
73
74       · If the argument is a prefix match on one of:
75
76         · owner: the owner hierarchy
77
78         · platform: the platform hierarchy
79
80         · endorsement: the endorsement hierarchy
81
82         · lockout: the lockout control persistent object
83
84       · If the argument argument can be loaded as a number it will  be  treat
85         as a handle, e.g.  0x81010013 and used directly.OBJECT.
86

Authorization Formatting

88       Authorization  for  use  of an object in TPM2.0 can come in 3 different
89       forms: 1.  Password 2.  HMAC 3.  Sessions
90
91       NOTE: "Authorizations default to the EMPTY  PASSWORD  when  not  speci‐
92       fied".
93
94   Passwords
95       Passwords  are  interpreted  in  the following forms below using prefix
96       identifiers.
97
98       Note: By default passwords are assumed to be in the  string  form  when
99       they do not have a prefix.
100
101   String
102       A  string  password,  specified  by  prefix "str:" or it's absence (raw
103       string without prefix) is not interpreted, and is directly used for au‐
104       thorization.
105
106   Examples
107              foobar
108              str:foobar
109
110   Hex-string
111       A  hex-string  password, specified by prefix "hex:" is converted from a
112       hexidecimal form into a byte array form, thus allowing  passwords  with
113       non-printable and/or terminal un-friendly characters.
114
115   Example
116              hex:0x1122334455667788
117
118   File
119       A  file  based password, specified be prefix "file:" should be the path
120       of a file containing the password to be read by the tool or  a  "-"  to
121       use  stdin.   Storing  passwords in files prevents information leakage,
122       passwords passed as options can be read from the process list or common
123       shell history features.
124
125   Examples
126              # to use stdin and be prompted
127              file:-
128
129              # to use a file from a path
130              file:path/to/password/file
131
132              # to echo a password via stdin:
133              echo foobar | tpm2_tool -p file:-
134
135              # to use a bash here-string via stdin:
136
137              tpm2_tool -p file:- <<< foobar
138
139   Sessions
140       When  using  a policy session to authorize the use of an object, prefix
141       the option argument with the session keyword.  Then indicate a path  to
142       a session file that was created with tpm2_startauthsession(1).  Option‐
143       ally, if the session requires an auth value to be sent with the session
144       handle  (eg policy password), then append a + and a string as described
145       in the Passwords section.
146
147   Examples
148       To use a session context file called session.ctx.
149
150              session:session.ctx
151
152       To use a session context file called session.ctx AND send the authvalue
153       mypassword.
154
155              session:session.ctx+mypassword
156
157       To use a session context file called session.ctx AND send the HEX auth‐
158       value 0x11223344.
159
160              session:session.ctx+hex:11223344
161
162   PCR Authorizations
163       You can satisfy a PCR policy using the "pcr:" prefix and the PCR  mini‐
164       language.       The     PCR     minilanguage     is     as     follows:
165       <pcr-spec>=<raw-pcr-file>
166
167       The PCR spec is documented in in the section "PCR bank specifiers".
168
169       The raw-pcr-file is an optional the output of the raw PCR  contents  as
170       returned by tpm2_pcrread(1).
171
172       PCR bank specifiers (common/pcr.md)
173
174   Examples
175       To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifi‐
176       er of:
177
178              pcr:sha256:0,1,2,3
179
180       specifying AUTH.
181

COMMON OPTIONS

183       This collection of options are common to many programs and provide  in‐
184       formation that many users may expect.
185
186       · -h,  --help=[man|no-man]:  Display the tools manpage.  By default, it
187         attempts to invoke the manpager for the  tool,  however,  on  failure
188         will  output  a short tool summary.  This is the same behavior if the
189         "man" option argument is specified, however if explicit "man" is  re‐
190         quested,  the  tool  will  provide errors from man on stderr.  If the
191         "no-man" option if specified, or the manpager fails,  the  short  op‐
192         tions will be output to stdout.
193
194         To  successfully use the manpages feature requires the manpages to be
195         installed or on MANPATH, See man(1) for more details.
196
197       · -v, --version: Display version information for this  tool,  supported
198         tctis and exit.
199
200       · -V,  --verbose:  Increase the information that the tool prints to the
201         console during its execution.  When using this option  the  file  and
202         line number are printed.
203
204       · -Q, --quiet: Silence normal tool output to stdout.
205
206       · -Z, --enable-errata: Enable the application of errata fixups.  Useful
207         if an errata fixup needs to be applied to commands sent to  the  TPM.
208         Defining  the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.  in‐
209         formation many users may expect.
210

TCTI Configuration

212       The TCTI or "Transmission Interface"  is  the  communication  mechanism
213       with  the TPM.  TCTIs can be changed for communication with TPMs across
214       different mediums.
215
216       To control the TCTI, the tools respect:
217
218       1. The command line option -T or --tcti
219
220       2. The environment variable: TPM2TOOLS_TCTI.
221
222       Note: The command line option always overrides  the  environment  vari‐
223       able.
224
225       The current known TCTIs are:
226
227       · tabrmd      -     The     resource     manager,     called     tabrmd
228         (https://github.com/tpm2-software/tpm2-abrmd).  Note that tabrmd  and
229         abrmd as a tcti name are synonymous.
230
231       · mssim  - Typically used for communicating to the TPM software simula‐
232         tor.
233
234       · device - Used when talking directly to a TPM device file.
235
236       · none - Do not initalize a connection with the TPM.  Some tools  allow
237         for off-tpm options and thus support not using a TCTI.  Tools that do
238         not support it will error when attempted to be used  without  a  TCTI
239         connection.   Does  not  support ANY options and MUST BE presented as
240         the exact text of "none".
241
242       The arguments to either the command  line  option  or  the  environment
243       variable are in the form:
244
245       <tcti-name>:<tcti-option-config>
246
247       Specifying  an  empty  string  for  either the <tcti-name> or <tcti-op‐
248       tion-config> results in the default being used for that portion respec‐
249       tively.
250
251   TCTI Defaults
252       When  a  TCTI  is not specified, the default TCTI is searched for using
253       dlopen(3) semantics.  The tools will  search  for  tabrmd,  device  and
254       mssim  TCTIs  IN THAT ORDER and USE THE FIRST ONE FOUND.  You can query
255       what TCTI will be chosen as the default by using the -v option to print
256       the  version information.  The "default-tcti" key-value pair will indi‐
257       cate which of the aforementioned TCTIs is the default.
258
259   Custom TCTIs
260       Any TCTI that implements the dynamic TCTI interface can be loaded.  The
261       tools internally use dlopen(3), and the raw tcti-name value is used for
262       the lookup.  Thus, this could be a path to the shared library, or a li‐
263       brary name as understood by dlopen(3) semantics.
264

TCTI OPTIONS

266       This collection of options are used to configure the various known TCTI
267       modules available:
268
269       · device: For the device TCTI, the TPM character device file for use by
270         the device TCTI can be specified.  The default is /dev/tpm0.
271
272         Example:    -T   device:/dev/tpm0   or   export   TPM2TOOLS_TCTI="de‐
273         vice:/dev/tpm0"
274
275       · mssim: For the mssim TCTI, the domain name or  IP  address  and  port
276         number  used  by  the  simulator  can  be specified.  The default are
277         127.0.0.1 and 2321.
278
279         Example: -T mssim:host=localhost,port=2321  or  export  TPM2TOOLS_TC‐
280         TI="mssim:host=localhost,port=2321"
281
282       · abrmd:  For  the abrmd TCTI, the configuration string format is a se‐
283         ries of simple key value pairs separated by a  ','  character.   Each
284         key and value string are separated by a '=' character.
285
286         · TCTI abrmd supports two keys:
287
288           1. 'bus_name'  :  The  name  of  the  tabrmd  service on the bus (a
289              string).
290
291           2. 'bus_type' : The type of the dbus instance (a string) limited to
292              'session' and 'system'.
293
294         Specify  the tabrmd tcti name and a config string of bus_name=com.ex‐
295         ample.FooBar:
296
297         \--tcti=tabrmd:bus_name=com.example.FooBar
298
299         Specify the default (abrmd) tcti and a config string of bus_type=ses‐
300         sion:
301
302         \--tcti:bus_type=session
303
304         NOTE:  abrmd  and tabrmd are synonymous.  the various known TCTI mod‐
305         ules.
306

EXAMPLES

308       Associate auth value of a sealing object to the owner  hierarchy  pass‐
309       word.   *  Start  a  trial auth session and run tpm2_policysecret(1) to
310       create policy that can only be satisfied if owner hierarchy auth  value
311       is supplied.  * Start a real policy session and provide the owner hier‐
312       archy auth value.  * Provide the session input where in  the  policyse‐
313       cret  for  owner hierarchy auth was satisfied to the unseal tool.  * If
314       the policy was satisfied unsealing should succeed.
315
316   Generate a policy that binds to the secret of the owner hiearchy
317              tpm2_startauthsession -S session.ctx
318
319              tpm2_policysecret -S session.ctx -c o -L secret.policy
320
321              tpm2_flushcontext session.ctx
322
323   Create a TPM object using the policy
324              tpm2_createprimary -Q -C o -g sha256 -G rsa -c prim.ctx
325
326              tpm2_create -Q -g sha256 -u sealing_key.pub -r sealing_key.priv -i- \
327                -C prim.ctx -L secret.policy <<< "SEALED-SECRET"
328
329              tpm2_load -C prim.ctx -u sealing_key.pub -r sealing_key.priv \
330                -c sealing_key.ctx
331
332   Satisfy the policy and unseal the secret
333              tpm2_startauthsession --policy-session -S session.ctx
334
335              tpm2_policysecret -S session.ctx -c o -L secret.policy
336
337              tpm2_unseal -p "session:session.ctx" -c sealing_key.ctx
338              SEALED-SECRET
339
340              tpm2_flushcontext session.ctx
341

Returns

343       Tools can return any of the following codes:
344
345       · 0 - Success.
346
347       · 1 - General non-specific error.
348
349       · 2 - Options handling error.
350
351       · 3 - Authentication error.
352
353       · 4 - TCTI related error.
354
355       · 5 - Non supported scheme.  Applicable to tpm2_testparams.
356

Limitations

358       It expects a session to be already established  via  tpm2_startauthses‐
359       sion(1) and requires one of the following:
360
361       · direct device access
362
363       · extended session support with tpm2-abrmd.
364
365       Without  it, most resource managers will not save session state between
366       command invocations.
367

BUGS

369       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
370

HELP

372       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
373
374
375
376tpm2-tools                                                tpm2_policysecret(1)
Impressum