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

NAME

6       tpm2_nvcertify(1)  -  Provides attestation of the contents of an NV in‐
7       dex.
8

SYNOPSIS

10       tpm2_nvcertify [OPTIONS] [ARGUMENTS]
11

DESCRIPTION

13       tpm2_nvcertify(1) - Provides attestation of the contents of an  NV  in‐
14       dex.   NOTE:  As  part of the attestation output, the NV index contents
15       are revealed.
16

OPTIONS

18       These options control the certification:
19
20       · -C, --signingkey-context=OBJECT:
21
22         The key object that signs the attestation structure.
23
24       · -P, --signingkey-auth=AUTH:
25
26         The authorization value provided for the object specified with -C.
27
28       · -c, --nvauthobj-context=OBJECT:
29
30         The object that is the authorization handle for the NV object.  It is
31         either  the  NV  index handle itself or the platform/ owner hierarchy
32         handle.  If not specified it defaults to the NV index handle.
33
34       · -p, --nvauthobj-auth=AUTH:
35
36         The authorization value provided for the object specified with -c.
37
38       · -g, --hash-algorithm=ALGORITHM:
39
40         The hash algorithm to use in signature generation.
41
42       · -s, --scheme=ALGORITHM:
43
44         The signing scheme used to sign the attestation data.
45
46       · -f, --format=FORMAT:
47
48         Format selection for the signature output file.
49
50       · -o, --signature=FILE:
51
52         Output file name for the signature data.
53
54       · -q, --qualification=FILE_OR_HEX_STR:
55
56         Optional, the policy qualifier data that the signer can choose to in‐
57         clude in the signature.  Can be either a hex string or path.
58
59       · --size=NATURAL_NUMBER:
60
61         Specifies  the  size  of data to be read in bytes, starting from 0 if
62         offset is not specified.  If not specified, the size of the  data  as
63         reported by the public portion of the index will be used.
64
65       · --offset=NATURAL_NUMBER:
66
67         The offset within the NV index to start reading from.
68
69       · --attestation=FILE:
70
71         The attestation data of the type TPM2_CREATION_INFO signed with sign‐
72         ing key.
73
74       · ARGUMENT the command line argument specifies the NV index  or  offset
75         number.
76
77   References

Context Object Format

79       The  type  of a context object, whether it is a handle or file name, is
80       determined according to the following logic in-order:
81
82       · If the argument is a file path, then the file is loaded as a restored
83         TPM transient object.
84
85       · If the argument is a prefix match on one of:
86
87         · owner: the owner hierarchy
88
89         · platform: the platform hierarchy
90
91         · endorsement: the endorsement hierarchy
92
93         · lockout: the lockout control persistent object
94
95       · If  the  argument argument can be loaded as a number it will be treat
96         as a handle, e.g.  0x81010013 and used directly.OBJECT.
97

Authorization Formatting

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

Algorithm Specifiers

194       Options that take algorithms support "nice-names".
195
196       There  are two major algorithm specification string classes, simple and
197       complex.  Only certain algorithms will be accepted by the TPM, based on
198       usage and conditions.
199
200   Simple specifiers
201       These are strings with no additional specification data.  When creating
202       objects, non-specified portions of an object are assumed  to  defaults.
203       You can find the list of known "Simple Specifiers Below".
204
205   Asymmetric
206       · rsa
207
208       · ecc
209
210   Symmetric
211       · aes
212
213       · camellia
214
215   Hashing Algorithms
216       · sha1
217
218       · sha256
219
220       · sha384
221
222       · sha512
223
224       · sm3_256
225
226       · sha3_256
227
228       · sha3_384
229
230       · sha3_512
231
232   Keyed Hash
233       · hmac
234
235       · xor
236
237   Signing Schemes
238       · rsassa
239
240       · rsapss
241
242       · ecdsa
243
244       · ecdaa
245
246       · ecschnorr
247
248   Asymmetric Encryption Schemes
249       · oaep
250
251       · rsaes
252
253       · ecdh
254
255   Modes
256       · ctr
257
258       · ofb
259
260       · cbc
261
262       · cfb
263
264       · ecb
265
266   Misc
267       · null
268
269   Complex Specifiers
270       Objects,  when  specified  for creation by the TPM, have numerous algo‐
271       rithms to populate in the public data.  Things like  type,  scheme  and
272       asymmetric  details,  key  size,  etc.  Below is the general format for
273       specifying this data: <type>:<scheme>:<symmetric-details>
274
275   Type Specifiers
276       This portion of the complex algorithm specifier is required.   The  re‐
277       maining  scheme  and  symmetric  details will default based on the type
278       specified and the type of the object being created.
279
280       · aes - Default AES: aes128
281
282       · aes128<mode> - 128 bit AES with optional mode  (ctr|ofb|cbc|cfb|ecb).
283         If mode is not specified, defaults to null.
284
285       · aes192<mode> - Same as aes128<mode>, except for a 192 bit key size.
286
287       · aes256<mode> - Same as aes128<mode>, except for a 256 bit key size.
288
289       · ecc - Elliptical Curve, defaults to ecc256.
290
291       · ecc192 - 192 bit ECC
292
293       · ecc224 - 224 bit ECC
294
295       · ecc256 - 256 bit ECC
296
297       · ecc384 - 384 bit ECC
298
299       · ecc521 - 521 bit ECC
300
301       · rsa - Default RSA: rsa2048
302
303       · rsa1024 - RSA with 1024 bit keysize.
304
305       · rsa2048 - RSA with 2048 bit keysize.
306
307       · rsa4096 - RSA with 4096 bit keysize.
308
309   Scheme Specifiers
310       Next, is an optional field, it can be skipped.
311
312       Schemes  are  usually Signing Schemes or Asymmetric Encryption Schemes.
313       Most signing schemes take a hash algorithm directly following the sign‐
314       ing  scheme.   If the hash algorithm is missing, it defaults to sha256.
315       Some take no arguments, and some take multiple arguments.
316
317   Hash Optional Scheme Specifiers
318       These scheme specifiers are followed by a dash and a valid  hash  algo‐
319       rithm, For example: oaep-sha256.
320
321       · oaep
322
323       · ecdh
324
325       · rsassa
326
327       · rsapss
328
329       · ecdsa
330
331       · ecschnorr
332
333   Multiple Option Scheme Specifiers
334       This  scheme  specifier  is  followed by a count (max size UINT16) then
335       folloed by a dash(-) and a valid hash algorithm.  * ecdaa For  example,
336       ecdaa4-sha256.  If no count is specified, it defaults to 4.
337
338   No Option Scheme Specifiers
339       This scheme specifier takes NO arguments.  * rsaes
340
341   Symmetric Details Specifiers
342       This  field is optional, and defaults based on the type of object being
343       created and it's attributes.  Generally, any valid Symmetric  specifier
344       from  the Type Specifiers list should work.  If not specified, an asym‐
345       metric objects symmetric details defaults to aes128cfb.
346
347   Examples
348   Create an rsa2048 key with an rsaes asymmetric encryption scheme
349       tpm2_create -C parent.ctx -G rsa2048:rsaes -u key.pub -r key.priv
350
351   Create an ecc256 key with an ecdaa signing scheme with a count of 4
352       and sha384 hash
353
354       /tpm2_create -C parent.ctx -G ecc256:ec‐
355       daa4-sha384 -u key.pub -r key.priv cryptographic algorithms ALGORITHM.
356

Signature Format Specifiers

358       Format selection for the signature output file.  tss (the default) will
359       output a binary blob according to the TPM 2.0 specification and any po‐
360       tential  compiler padding.  The option plain will output the plain sig‐
361       nature data as defined by the used cryptographic algorithm.   signature
362       FORMAT.
363

COMMON OPTIONS

365       This  collection of options are common to many programs and provide in‐
366       formation that many users may expect.
367
368       · -h, --help=[man|no-man]: Display the tools manpage.  By  default,  it
369         attempts  to  invoke  the  manpager for the tool, however, on failure
370         will output a short tool summary.  This is the same behavior  if  the
371         "man"  option argument is specified, however if explicit "man" is re‐
372         quested, the tool will provide errors from man  on  stderr.   If  the
373         "no-man"  option  if  specified, or the manpager fails, the short op‐
374         tions will be output to stdout.
375
376         To successfully use the manpages feature requires the manpages to  be
377         installed or on MANPATH, See man(1) for more details.
378
379       · -v,  --version:  Display version information for this tool, supported
380         tctis and exit.
381
382       · -V, --verbose: Increase the information that the tool prints  to  the
383         console  during  its  execution.  When using this option the file and
384         line number are printed.
385
386       · -Q, --quiet: Silence normal tool output to stdout.
387
388       · -Z, --enable-errata: Enable the application of errata fixups.  Useful
389         if  an  errata fixup needs to be applied to commands sent to the TPM.
390         Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.   in‐
391         formation many users may expect.
392

TCTI Configuration

394       The  TCTI  or  "Transmission  Interface" is the communication mechanism
395       with the TPM.  TCTIs can be changed for communication with TPMs  across
396       different mediums.
397
398       To control the TCTI, the tools respect:
399
400       1. The command line option -T or --tcti
401
402       2. The environment variable: TPM2TOOLS_TCTI.
403
404       Note:  The  command  line option always overrides the environment vari‐
405       able.
406
407       The current known TCTIs are:
408
409       · tabrmd     -     The     resource     manager,     called      tabrmd
410         (https://github.com/tpm2-software/tpm2-abrmd).   Note that tabrmd and
411         abrmd as a tcti name are synonymous.
412
413       · mssim - Typically used for communicating to the TPM software  simula‐
414         tor.
415
416       · device - Used when talking directly to a TPM device file.
417
418       · none  - Do not initalize a connection with the TPM.  Some tools allow
419         for off-tpm options and thus support not using a TCTI.  Tools that do
420         not  support  it  will error when attempted to be used without a TCTI
421         connection.  Does not support ANY options and MUST  BE  presented  as
422         the exact text of "none".
423
424       The  arguments  to  either  the  command line option or the environment
425       variable are in the form:
426
427       <tcti-name>:<tcti-option-config>
428
429       Specifying an empty string for  either  the  <tcti-name>  or  <tcti-op‐
430       tion-config> results in the default being used for that portion respec‐
431       tively.
432
433   TCTI Defaults
434       When a TCTI is not specified, the default TCTI is  searched  for  using
435       dlopen(3)  semantics.   The  tools  will  search for tabrmd, device and
436       mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND.  You  can  query
437       what TCTI will be chosen as the default by using the -v option to print
438       the version information.  The "default-tcti" key-value pair will  indi‐
439       cate which of the aforementioned TCTIs is the default.
440
441   Custom TCTIs
442       Any TCTI that implements the dynamic TCTI interface can be loaded.  The
443       tools internally use dlopen(3), and the raw tcti-name value is used for
444       the lookup.  Thus, this could be a path to the shared library, or a li‐
445       brary name as understood by dlopen(3) semantics.
446

TCTI OPTIONS

448       This collection of options are used to configure the various known TCTI
449       modules available:
450
451       · device: For the device TCTI, the TPM character device file for use by
452         the device TCTI can be specified.  The default is /dev/tpm0.
453
454         Example:   -T   device:/dev/tpm0   or   export    TPM2TOOLS_TCTI="de‐
455         vice:/dev/tpm0"
456
457       · mssim:  For  the  mssim  TCTI, the domain name or IP address and port
458         number used by the simulator  can  be  specified.   The  default  are
459         127.0.0.1 and 2321.
460
461         Example:  -T  mssim:host=localhost,port=2321  or export TPM2TOOLS_TC‐
462         TI="mssim:host=localhost,port=2321"
463
464       · abrmd: For the abrmd TCTI, the configuration string format is  a  se‐
465         ries  of  simple  key value pairs separated by a ',' character.  Each
466         key and value string are separated by a '=' character.
467
468         · TCTI abrmd supports two keys:
469
470           1. 'bus_name' : The name of  the  tabrmd  service  on  the  bus  (a
471              string).
472
473           2. 'bus_type' : The type of the dbus instance (a string) limited to
474              'session' and 'system'.
475
476         Specify the tabrmd tcti name and a config string of  bus_name=com.ex‐
477         ample.FooBar:
478
479         \--tcti=tabrmd:bus_name=com.example.FooBar
480
481         Specify the default (abrmd) tcti and a config string of bus_type=ses‐
482         sion:
483
484         \--tcti:bus_type=session
485
486         NOTE: abrmd and tabrmd are synonymous.  the various known  TCTI  mod‐
487         ules.
488

EXAMPLES

490              tpm2_nvdefine -s 32 -a "authread|authwrite" 1
491
492              dd if=/dev/urandom bs=1 count=32 status=none| \
493              tpm2_nvwrite 1 -i-
494
495              tpm2_createprimary -C o -c primary.ctx -Q
496
497              tpm2_create -G rsa -u rsa.pub -r rsa.priv -C primary.ctx -c signing_key.ctx -Q
498
499              tpm2_readpublic -c signing_key.ctx -f pem -o sslpub.pem -Q
500
501              tpm2_nvcertify -C signing_key.ctx -g sha256 -f plain -s rsassa \
502              -o signature.bin --attestation attestation.bin --size 32 1
503

Returns

505       Tools can return any of the following codes:
506
507       · 0 - Success.
508
509       · 1 - General non-specific error.
510
511       · 2 - Options handling error.
512
513       · 3 - Authentication error.
514
515       · 4 - TCTI related error.
516
517       · 5 - Non supported scheme.  Applicable to tpm2_testparams.
518

BUGS

520       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
521

HELP

523       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
524
525
526
527tpm2-tools                                                   tpm2_nvcertify(1)
Impressum