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

NAME

6       tpm2_create(1) - Create a child object.
7

SYNOPSIS

9       tpm2_create [OPTIONS]
10

DESCRIPTION

12       tpm2_create(1) - Create a child object.  The object can either be a key
13       or a sealing object.  A sealing object allows to seal user data to  the
14       TPM,  with  a maximum size of 256 bytes.  Additionally it will load the
15       created object if the -o is specified.
16

OPTIONS

18       These options for creating the TPM entity:
19
20       · -C, --parent-context=OBJECT:
21
22         The parent of the object to be created.
23
24       · -P, --parent-auth=AUTH:
25
26         The authorization value of the parent object specified with -C.
27
28       · -p, --key-auth=AUTH:
29
30         The authorization value for the created object.
31
32       · -g, --hash-algorithm=ALGORITHM:
33
34         The hash algorithm for generating the objects name.  This is optional
35         and defaults to sha256 when not specified.
36
37       · -G, --key-algorithm=ALGORITHM:
38
39         The  key algorithm associated with this object.  It defaults to "rsa"
40         if not specified.
41
42       · -a, --attributes=ATTRIBUTES:
43
44         The object attributes, optional.  The default for created objects is:
45
46         TPMA_OBJECT_SIGN_ENCRYPT|TPMA_OBJECT_DECRYPT|TPMA_OB‐
47         JECT_FIXEDTPM|  TPMA_OBJECT_FIXEDPARENT|TPMA_OBJECT_SENSITIVEDATAORI‐
48         GIN|  TPMA_OBJECT_USERWITHAUTH
49
50         When -i is specified for sealing,  TPMA_OBJECT_SIGN_ENCRYPT  and  TP‐
51         MA_OBJECT_DECRYPT  are  removed  from the default attribute set.  The
52         algorithm is set in a way where the the object is only good for seal‐
53         ing  and  unsealing.   I.e.  one cannot use an object for sealing and
54         cryptography operations.
55
56       · -i, --sealing-input=FILE or STDIN:
57
58         The data file to be sealed, optional.  If file is -, read from stdin.
59         When  sealing  data  only the TPM_ALG_KEYEDHASH algorithm with a NULL
60         scheme is allowed.  Thus, -G cannot be specified.
61
62       · -L, --policy=FILE:
63
64         The input policy file, optional.
65
66       · -u, --public=FILE:
67
68         The output file which contains the public portion of the created  ob‐
69         ject, optional.
70
71       · -r, --private=FILE:
72
73         The  output  file which contains the sensitive portion of the object,
74         optional.
75
76       · -c, --key-context=FILE:
77
78         The output file which contains the key context,  optional.   The  key
79         context  is  analogous  to the context file produced by tpm2_load(1),
80         however is generated via a tpm2_createloaded(1) command.  This option
81         can  be used to avoid the normal tpm2_create(1) and tpm2_load(1) com‐
82         mand sequences and do it all in one command, atomically.
83
84       · --creation-data=FILE:
85
86         An optional file output that saves the creation data  for  certifica‐
87         tion.
88
89         · --template-data=FILE:
90
91         An  optional file output that saves the key template data (TPM2B_PUB‐
92         LIC) to be used in tpm2_policytemplate.
93
94       · -t, --creation-ticket=FILE:
95
96         An optional file output that saves the creation ticket for certifica‐
97         tion.
98
99       · -d, --creation-hash=FILE:
100
101         An  optional  file output that saves the creation hash for certifica‐
102         tion.
103
104       · -q, --outside-info=HEX_STR_OR_FILE:
105
106         An optional hex string or path to add unique data to the creation da‐
107         ta.   Note  that  it  does  not  contribute in creating statistically
108         unique object.
109
110       · -l, --pcr-list=PCR:
111
112         The list of PCR banks and selected PCRs' ids for each bank to be  in‐
113         cluded in the creation data for certification.
114
115   References

Context Object Format

117       The  type  of a context object, whether it is a handle or file name, is
118       determined according to the following logic in-order:
119
120       · If the argument is a file path, then the file is loaded as a restored
121         TPM transient object.
122
123       · If the argument is a prefix match on one of:
124
125         · owner: the owner hierarchy
126
127         · platform: the platform hierarchy
128
129         · endorsement: the endorsement hierarchy
130
131         · lockout: the lockout control persistent object
132
133       · If  the  argument argument can be loaded as a number it will be treat
134         as a handle, e.g.  0x81010013 and used directly.OBJECT.
135

Authorization Formatting

137       Authorization for use of an object in TPM2.0 can come  in  3  different
138       forms: 1.  Password 2.  HMAC 3.  Sessions
139
140       NOTE:  "Authorizations  default  to  the EMPTY PASSWORD when not speci‐
141       fied".
142
143   Passwords
144       Passwords are interpreted in the following  forms  below  using  prefix
145       identifiers.
146
147       Note:  By  default  passwords are assumed to be in the string form when
148       they do not have a prefix.
149
150   String
151       A string password, specified by prefix  "str:"  or  it's  absence  (raw
152       string without prefix) is not interpreted, and is directly used for au‐
153       thorization.
154
155   Examples
156              foobar
157              str:foobar
158
159   Hex-string
160       A hex-string password, specified by prefix "hex:" is converted  from  a
161       hexidecimal  form  into a byte array form, thus allowing passwords with
162       non-printable and/or terminal un-friendly characters.
163
164   Example
165              hex:0x1122334455667788
166
167   File
168       A file based password, specified be prefix "file:" should be  the  path
169       of  a  file  containing the password to be read by the tool or a "-" to
170       use stdin.  Storing passwords in files  prevents  information  leakage,
171       passwords passed as options can be read from the process list or common
172       shell history features.
173
174   Examples
175              # to use stdin and be prompted
176              file:-
177
178              # to use a file from a path
179              file:path/to/password/file
180
181              # to echo a password via stdin:
182              echo foobar | tpm2_tool -p file:-
183
184              # to use a bash here-string via stdin:
185
186              tpm2_tool -p file:- <<< foobar
187
188   Sessions
189       When using a policy session to authorize the use of an  object,  prefix
190       the  option argument with the session keyword.  Then indicate a path to
191       a session file that was created with tpm2_startauthsession(1).  Option‐
192       ally, if the session requires an auth value to be sent with the session
193       handle (eg policy password), then append a + and a string as  described
194       in the Passwords section.
195
196   Examples
197       To use a session context file called session.ctx.
198
199              session:session.ctx
200
201       To use a session context file called session.ctx AND send the authvalue
202       mypassword.
203
204              session:session.ctx+mypassword
205
206       To use a session context file called session.ctx AND send the HEX auth‐
207       value 0x11223344.
208
209              session:session.ctx+hex:11223344
210
211   PCR Authorizations
212       You  can satisfy a PCR policy using the "pcr:" prefix and the PCR mini‐
213       language.      The     PCR     minilanguage     is     as      follows:
214       <pcr-spec>=<raw-pcr-file>
215
216       The PCR spec is documented in in the section "PCR bank specifiers".
217
218       The  raw-pcr-file  is an optional the output of the raw PCR contents as
219       returned by tpm2_pcrread(1).
220
221       PCR bank specifiers (common/pcr.md)
222
223   Examples
224       To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifi‐
225       er of:
226
227              pcr:sha256:0,1,2,3
228
229       specifying AUTH.
230

Algorithm Specifiers

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

Object Attributes

396       Object Attributes are used to control various properties of created ob‐
397       jects.  When specified as an option, either the raw  bitfield  mask  or
398       "nice-names"  may  be used.  The values can be found in Table 31 Part 2
399       of the TPM2.0 specification, which can be found here:
400
401       <https://trustedcomputinggroup.org/wp-content/uploads/TPM-
402       Rev-2.0-Part-2-Structures-01.38.pdf>
403
404       Nice  names are calculated by taking the name field of table 31 and re‐
405       moving the prefix TPMA_OBJECT_ and lowercasing the result.   Thus,  TP‐
406       MA_OBJECT_FIXEDTPM  becomes  fixedtpm.   Nice names can be joined using
407       the bitwise or "|" symbol.
408
409       For instance, to set The fields TPMA_OBJECT_FIXEDTPM, TPMA_OBJECT_NODA,
410       and TPMA_OBJECT_SIGN_ENCRYPT, the argument would be:
411
412       fixedtpm|noda|sign specifying the object attributes ATTRIBUTES.
413

COMMON OPTIONS

415       This  collection of options are common to many programs and provide in‐
416       formation that many users may expect.
417
418       · -h, --help=[man|no-man]: Display the tools manpage.  By  default,  it
419         attempts  to  invoke  the  manpager for the tool, however, on failure
420         will output a short tool summary.  This is the same behavior  if  the
421         "man"  option argument is specified, however if explicit "man" is re‐
422         quested, the tool will provide errors from man  on  stderr.   If  the
423         "no-man"  option  if  specified, or the manpager fails, the short op‐
424         tions will be output to stdout.
425
426         To successfully use the manpages feature requires the manpages to  be
427         installed or on MANPATH, See man(1) for more details.
428
429       · -v,  --version:  Display version information for this tool, supported
430         tctis and exit.
431
432       · -V, --verbose: Increase the information that the tool prints  to  the
433         console  during  its  execution.  When using this option the file and
434         line number are printed.
435
436       · -Q, --quiet: Silence normal tool output to stdout.
437
438       · -Z, --enable-errata: Enable the application of errata fixups.  Useful
439         if  an  errata fixup needs to be applied to commands sent to the TPM.
440         Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.   in‐
441         formation many users may expect.
442

TCTI Configuration

444       The  TCTI  or  "Transmission  Interface" is the communication mechanism
445       with the TPM.  TCTIs can be changed for communication with TPMs  across
446       different mediums.
447
448       To control the TCTI, the tools respect:
449
450       1. The command line option -T or --tcti
451
452       2. The environment variable: TPM2TOOLS_TCTI.
453
454       Note:  The  command  line option always overrides the environment vari‐
455       able.
456
457       The current known TCTIs are:
458
459       · tabrmd     -     The     resource     manager,     called      tabrmd
460         (https://github.com/tpm2-software/tpm2-abrmd).   Note that tabrmd and
461         abrmd as a tcti name are synonymous.
462
463       · mssim - Typically used for communicating to the TPM software  simula‐
464         tor.
465
466       · device - Used when talking directly to a TPM device file.
467
468       · none  - Do not initalize a connection with the TPM.  Some tools allow
469         for off-tpm options and thus support not using a TCTI.  Tools that do
470         not  support  it  will error when attempted to be used without a TCTI
471         connection.  Does not support ANY options and MUST  BE  presented  as
472         the exact text of "none".
473
474       The  arguments  to  either  the  command line option or the environment
475       variable are in the form:
476
477       <tcti-name>:<tcti-option-config>
478
479       Specifying an empty string for  either  the  <tcti-name>  or  <tcti-op‐
480       tion-config> results in the default being used for that portion respec‐
481       tively.
482
483   TCTI Defaults
484       When a TCTI is not specified, the default TCTI is  searched  for  using
485       dlopen(3)  semantics.   The  tools  will  search for tabrmd, device and
486       mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND.  You  can  query
487       what TCTI will be chosen as the default by using the -v option to print
488       the version information.  The "default-tcti" key-value pair will  indi‐
489       cate which of the aforementioned TCTIs is the default.
490
491   Custom TCTIs
492       Any TCTI that implements the dynamic TCTI interface can be loaded.  The
493       tools internally use dlopen(3), and the raw tcti-name value is used for
494       the lookup.  Thus, this could be a path to the shared library, or a li‐
495       brary name as understood by dlopen(3) semantics.
496

TCTI OPTIONS

498       This collection of options are used to configure the various known TCTI
499       modules available:
500
501       · device: For the device TCTI, the TPM character device file for use by
502         the device TCTI can be specified.  The default is /dev/tpm0.
503
504         Example:   -T   device:/dev/tpm0   or   export    TPM2TOOLS_TCTI="de‐
505         vice:/dev/tpm0"
506
507       · mssim:  For  the  mssim  TCTI, the domain name or IP address and port
508         number used by the simulator  can  be  specified.   The  default  are
509         127.0.0.1 and 2321.
510
511         Example:  -T  mssim:host=localhost,port=2321  or export TPM2TOOLS_TC‐
512         TI="mssim:host=localhost,port=2321"
513
514       · abrmd: For the abrmd TCTI, the configuration string format is  a  se‐
515         ries  of  simple  key value pairs separated by a ',' character.  Each
516         key and value string are separated by a '=' character.
517
518         · TCTI abrmd supports two keys:
519
520           1. 'bus_name' : The name of  the  tabrmd  service  on  the  bus  (a
521              string).
522
523           2. 'bus_type' : The type of the dbus instance (a string) limited to
524              'session' and 'system'.
525
526         Specify the tabrmd tcti name and a config string of  bus_name=com.ex‐
527         ample.FooBar:
528
529         \--tcti=tabrmd:bus_name=com.example.FooBar
530
531         Specify the default (abrmd) tcti and a config string of bus_type=ses‐
532         sion:
533
534         \--tcti:bus_type=session
535
536         NOTE: abrmd and tabrmd are synonymous.  the various known  TCTI  mod‐
537         ules.
538

EXAMPLES

540   Setup
541       In  order  to  create  an object, we must first create a primary key as
542       it's parent.
543
544              tpm2_createprimary -c primary.ctx
545
546   Create an Object
547       This will create an object using all the default values and  store  the
548       TPM  sealed  private  and public portions to the paths specified via -u
549       and -r respectively.  The tool defaults to an RSA key.
550
551              tpm2_create -C primary.ctx -u obj.pub -r obj.priv
552
553   Seal Data to the TPM
554       Outside of key objects, the TPM allows for small amounts of user speci‐
555       fied data to be sealed to the TPM.
556
557              echo "my sealed data" > seal.dat
558              tpm2_create -C primary.ctx -i seal.dat -u obj.pub -r obj.priv
559
560   Create an EC Key Object and Load it to the TPM
561       Normally, when creating an object, only the public and private portions
562       of the object are returned and the caller needs to use tpm2_load(1)  to
563       load  those public and private portions to the TPM before being able to
564       use the object.  However, this can be accomplished within this  command
565       as well.
566
567              tpm2_create -C primary.ctx -G ecc -u obj.pub -r obj.priv -c ecc.ctx
568

Returns

570       Tools can return any of the following codes:
571
572       · 0 - Success.
573
574       · 1 - General non-specific error.
575
576       · 2 - Options handling error.
577
578       · 3 - Authentication error.
579
580       · 4 - TCTI related error.
581
582       · 5 - Non supported scheme.  Applicable to tpm2_testparams.
583

BUGS

585       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
586

HELP

588       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
589
590
591
592tpm2-tools                                                      tpm2_create(1)
Impressum