tpm2_create.1 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_create" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_create\f[](1) \- Create a child object.
  8. .SH SYNOPSIS
  9. .PP
  10. \f[B]tpm2_create\f[] [\f[I]OPTIONS\f[]]
  11. .SH DESCRIPTION
  12. .PP
  13. \f[B]tpm2_create\f[](1) \- Create a child object.
  14. The object can either be a key or a sealing object.
  15. A sealing object allows to seal user data to the TPM, with a maximum
  16. size of 128 bytes.
  17. Additionally it will load the created object if the \f[B]\-c\f[] is
  18. specified.
  19. .SH OPTIONS
  20. .PP
  21. These options for creating the TPM entity:
  22. .IP \[bu] 2
  23. \f[B]\-C\f[], \f[B]\-\-parent\-context\f[]=\f[I]OBJECT\f[]:
  24. .RS 2
  25. .PP
  26. The parent of the object to be created.
  27. .RE
  28. .IP \[bu] 2
  29. \f[B]\-P\f[], \f[B]\-\-parent\-auth\f[]=\f[I]AUTH\f[]:
  30. .RS 2
  31. .PP
  32. The authorization value of the parent object specified with
  33. \f[B]\-C\f[].
  34. .RE
  35. .IP \[bu] 2
  36. \f[B]\-p\f[], \f[B]\-\-key\-auth\f[]=\f[I]AUTH\f[]:
  37. .RS 2
  38. .PP
  39. The authorization value for the created object.
  40. .RE
  41. .IP \[bu] 2
  42. \f[B]\-g\f[], \f[B]\-\-hash\-algorithm\f[]=\f[I]ALGORITHM\f[]:
  43. .RS 2
  44. .PP
  45. The hash algorithm for generating the objects name.
  46. This is optional and defaults to sha256 when not specified.
  47. .RE
  48. .IP \[bu] 2
  49. \f[B]\-G\f[], \f[B]\-\-key\-algorithm\f[]=\f[I]ALGORITHM\f[]:
  50. .RS 2
  51. .PP
  52. The key algorithm associated with this object.
  53. It defaults to "rsa" if not specified.
  54. .RE
  55. .IP \[bu] 2
  56. \f[B]\-a\f[], \f[B]\-\-attributes\f[]=\f[I]ATTRIBUTES\f[]:
  57. .RS 2
  58. .PP
  59. The object attributes, optional.
  60. The default for created objects is:
  61. .PP
  62. \f[C]TPMA_OBJECT_SIGN_ENCRYPT|TPMA_OBJECT_DECRYPT|TPMA_OBJECT_FIXEDTPM|\ \ TPMA_OBJECT_FIXEDPARENT|TPMA_OBJECT_SENSITIVEDATAORIGIN|\ \ TPMA_OBJECT_USERWITHAUTH\f[]
  63. .PP
  64. When \f[B]\-i\f[] is specified for sealing,
  65. \f[C]TPMA_OBJECT_SIGN_ENCRYPT\f[] and \f[C]TPMA_OBJECT_DECRYPT\f[] are
  66. removed from the default attribute set.
  67. The algorithm is set in a way where the the object is only good for
  68. sealing and unsealing.
  69. I.e.
  70. one cannot use an object for sealing and cryptography operations.
  71. .PP
  72. When \f[B]\-L\f[] is specified for adding policy based authorization
  73. information AND no string password is specified, the attribute
  74. \f[C]TPMA_OBJECT_USERWITHAUTH\f[] is cleared unless an explicit choice
  75. is made by setting of the attribute with \f[B]\-a\f[] option.
  76. This prevents creation of objects with inadvertant auth model where in
  77. user intended to enforce a policy but inadvertantly created an object
  78. with empty auth which can be used instead of policy authorization.
  79. .RE
  80. .IP \[bu] 2
  81. \f[B]\-i\f[], \f[B]\-\-sealing\-input\f[]=\f[I]FILE\f[] or
  82. \f[I]STDIN\f[]:
  83. .RS 2
  84. .PP
  85. The data file to be sealed, optional.
  86. If file is \-, read from stdin.
  87. When sealing data only the \f[I]TPM_ALG_KEYEDHASH\f[] algorithm with a
  88. NULL scheme is allowed.
  89. Thus, \f[B]\-G\f[] cannot be specified.
  90. .RE
  91. .IP \[bu] 2
  92. \f[B]\-L\f[], \f[B]\-\-policy\f[]=\f[I]FILE\f[]:
  93. .RS 2
  94. .PP
  95. The input policy file, optional.
  96. .RE
  97. .IP \[bu] 2
  98. \f[B]\-u\f[], \f[B]\-\-public\f[]=\f[I]FILE\f[]:
  99. .RS 2
  100. .PP
  101. The output file which contains the public portion of the created object,
  102. optional.
  103. .RE
  104. .IP \[bu] 2
  105. \f[B]\-r\f[], \f[B]\-\-private\f[]=\f[I]FILE\f[]:
  106. .RS 2
  107. .PP
  108. The output file which contains the sensitive portion of the object,
  109. optional.
  110. # Protection Details
  111. .RE
  112. .PP
  113. Objects that can move outside of TPM need to be protected
  114. (confidentiality and integrity).
  115. For instance, transient objects require that TPM protected data (key or
  116. seal material) be stored outside of the TPM.
  117. This is seen in tools like tpm2_create(1), where the \f[B]\-r\f[] option
  118. outputs this protected data.
  119. This blob contains the sensitive portions of the object.
  120. The sensitive portions of the object are protected by the parent object,
  121. using the parent\[aq]s symmetric encryption details to encrypt the
  122. sensitive data and HMAC it.
  123. .PP
  124. In\-depth details can be found in sections 23 of:
  125. .IP \[bu] 2
  126. https://trustedcomputinggroup.org/wp\-content/uploads/TPM\-Rev\-2.0\-Part\-1\-Architecture\-01.38.pdf
  127. .PP
  128. Notably Figure 20, is relevant, even though it\[aq]s specifically
  129. referring to duplication blobs, the process is identical.
  130. .PP
  131. If the output is from tpm2_duplicate(1), the output will be slightly
  132. different, as described fully in section 23.
  133. .IP \[bu] 2
  134. \f[B]\-c\f[], \f[B]\-\-key\-context\f[]=\f[I]FILE\f[]:
  135. .RS 2
  136. .PP
  137. The output file which contains the key context, optional.
  138. The key context is analogous to the context file produced by
  139. \f[B]tpm2_load\f[](1), however is generated via a
  140. \f[B]tpm2_createloaded\f[](1) command.
  141. This option can be used to avoid the normal \f[B]tpm2_create\f[](1) and
  142. \f[B]tpm2_load\f[](1) command sequences and do it all in one command,
  143. atomically.
  144. .RE
  145. .IP \[bu] 2
  146. \f[B]\-\-creation\-data\f[]=\f[I]FILE\f[]:
  147. .RS 2
  148. .PP
  149. An optional file output that saves the creation data for certification.
  150. .IP \[bu] 2
  151. \f[B]\-\-template\-data\f[]=\f[I]FILE\f[]:
  152. .PP
  153. An optional file output that saves the key template data (TPM2B_PUBLIC)
  154. to be used in \f[B]tpm2_policytemplate\f[].
  155. .RE
  156. .IP \[bu] 2
  157. \f[B]\-t\f[], \f[B]\-\-creation\-ticket\f[]=\f[I]FILE\f[]:
  158. .RS 2
  159. .PP
  160. An optional file output that saves the creation ticket for
  161. certification.
  162. .RE
  163. .IP \[bu] 2
  164. \f[B]\-d\f[], \f[B]\-\-creation\-hash\f[]=\f[I]FILE\f[]:
  165. .RS 2
  166. .PP
  167. An optional file output that saves the creation hash for certification.
  168. .RE
  169. .IP \[bu] 2
  170. \f[B]\-q\f[], \f[B]\-\-outside\-info\f[]=\f[I]HEX_STR_OR_FILE\f[]:
  171. .RS 2
  172. .PP
  173. An optional hex string or path to add unique data to the creation data.
  174. Note that it does not contribute in creating statistically unique
  175. object.
  176. .RE
  177. .IP \[bu] 2
  178. \f[B]\-l\f[], \f[B]\-\-pcr\-list\f[]=\f[I]PCR\f[]:
  179. .RS 2
  180. .PP
  181. The list of PCR banks and selected PCRs\[aq] ids for each bank to be
  182. included in the creation data for certification.
  183. .RE
  184. .IP \[bu] 2
  185. \f[B]\-\-cphash\f[]=\f[I]FILE\f[]
  186. .RS 2
  187. .PP
  188. File path to record the hash of the command parameters.
  189. This is commonly termed as cpHash.
  190. NOTE: When this option is selected, The tool will not actually execute
  191. the command, it simply returns a cpHash.
  192. .RE
  193. .IP \[bu] 2
  194. \f[B]\-\-rphash\f[]=\f[I]FILE\f[]
  195. .RS 2
  196. .PP
  197. File path to record the hash of the response parameters.
  198. This is commonly termed as rpHash.
  199. .RE
  200. .IP \[bu] 2
  201. \f[B]\-S\f[], \f[B]\-\-session\f[]=\f[I]FILE\f[]:
  202. .RS 2
  203. .PP
  204. The session created using \f[B]tpm2_startauthsession\f[].
  205. Multiple of these can be specified.
  206. For example, you can have one session for auditing and another for
  207. encryption/decryption of the parameters.
  208. .RE
  209. .SS References
  210. .SH Context Object Format
  211. .PP
  212. The type of a context object, whether it is a handle or file name, is
  213. determined according to the following logic \f[I]in\-order\f[]:
  214. .IP \[bu] 2
  215. If the argument is a file path, then the file is loaded as a restored
  216. TPM transient object.
  217. .IP \[bu] 2
  218. If the argument is a \f[I]prefix\f[] match on one of:
  219. .RS 2
  220. .IP \[bu] 2
  221. owner: the owner hierarchy
  222. .IP \[bu] 2
  223. platform: the platform hierarchy
  224. .IP \[bu] 2
  225. endorsement: the endorsement hierarchy
  226. .IP \[bu] 2
  227. lockout: the lockout control persistent object
  228. .RE
  229. .IP \[bu] 2
  230. If the argument argument can be loaded as a number it will be treat as a
  231. handle, e.g.
  232. 0x81010013 and used directly.\f[I]OBJECT\f[].
  233. .SH Authorization Formatting
  234. .PP
  235. Authorization for use of an object in TPM2.0 can come in 3 different
  236. forms: 1.
  237. Password 2.
  238. HMAC 3.
  239. Sessions
  240. .PP
  241. \f[B]NOTE:\f[] "Authorizations default to the \f[B]EMPTY PASSWORD\f[]
  242. when not specified".
  243. .SS Passwords
  244. .PP
  245. Passwords are interpreted in the following forms below using prefix
  246. identifiers.
  247. .PP
  248. \f[B]Note\f[]: By default passwords are assumed to be in the string form
  249. when they do not have a prefix.
  250. .SS String
  251. .PP
  252. A string password, specified by prefix "str:" or it\[aq]s absence (raw
  253. string without prefix) is not interpreted, and is directly used for
  254. authorization.
  255. .SS Examples
  256. .IP
  257. .nf
  258. \f[C]
  259. foobar
  260. str:foobar
  261. \f[]
  262. .fi
  263. .SS Hex\-string
  264. .PP
  265. A hex\-string password, specified by prefix "hex:" is converted from a
  266. hexidecimal form into a byte array form, thus allowing passwords with
  267. non\-printable and/or terminal un\-friendly characters.
  268. .SS Example
  269. .IP
  270. .nf
  271. \f[C]
  272. hex:0x1122334455667788
  273. \f[]
  274. .fi
  275. .SS File
  276. .PP
  277. A file based password, specified be prefix "file:" should be the path of
  278. a file containing the password to be read by the tool or a "\-" to use
  279. stdin.
  280. Storing passwords in files prevents information leakage, passwords
  281. passed as options can be read from the process list or common shell
  282. history features.
  283. .SS Examples
  284. .IP
  285. .nf
  286. \f[C]
  287. #\ to\ use\ stdin\ and\ be\ prompted
  288. file:\-
  289. #\ to\ use\ a\ file\ from\ a\ path
  290. file:path/to/password/file
  291. #\ to\ echo\ a\ password\ via\ stdin:
  292. echo\ foobar\ |\ tpm2_tool\ \-p\ file:\-
  293. #\ to\ use\ a\ bash\ here\-string\ via\ stdin:
  294. tpm2_tool\ \-p\ file:\-\ <<<\ foobar
  295. \f[]
  296. .fi
  297. .SS Sessions
  298. .PP
  299. When using a policy session to authorize the use of an object, prefix
  300. the option argument with the \f[I]session\f[] keyword.
  301. Then indicate a path to a session file that was created with
  302. tpm2_startauthsession(1).
  303. Optionally, if the session requires an auth value to be sent with the
  304. session handle (eg policy password), then append a + and a string as
  305. described in the \f[B]Passwords\f[] section.
  306. .SS Examples
  307. .PP
  308. To use a session context file called \f[I]session.ctx\f[].
  309. .IP
  310. .nf
  311. \f[C]
  312. session:session.ctx
  313. \f[]
  314. .fi
  315. .PP
  316. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  317. send the authvalue mypassword.
  318. .IP
  319. .nf
  320. \f[C]
  321. session:session.ctx+mypassword
  322. \f[]
  323. .fi
  324. .PP
  325. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  326. send the \f[I]HEX\f[] authvalue 0x11223344.
  327. .IP
  328. .nf
  329. \f[C]
  330. session:session.ctx+hex:11223344
  331. \f[]
  332. .fi
  333. .SS PCR Authorizations
  334. .PP
  335. You can satisfy a PCR policy using the "pcr:" prefix and the PCR
  336. minilanguage.
  337. The PCR minilanguage is as follows:
  338. \f[C]<pcr\-spec>=<raw\-pcr\-file>\f[]
  339. .PP
  340. The PCR spec is documented in in the section "PCR bank specifiers".
  341. .PP
  342. The \f[C]raw\-pcr\-file\f[] is an \f[B]optional\f[] the output of the
  343. raw PCR contents as returned by \f[I]tpm2_pcrread(1)\f[].
  344. .PP
  345. PCR bank specifiers (common/pcr.md)
  346. .SS Examples
  347. .PP
  348. To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifier
  349. of:
  350. .IP
  351. .nf
  352. \f[C]
  353. pcr:sha256:0,1,2,3
  354. \f[]
  355. .fi
  356. .PP
  357. specifying \f[I]AUTH\f[].
  358. .SH Algorithm Specifiers
  359. .PP
  360. Options that take algorithms support "nice\-names".
  361. .PP
  362. There are two major algorithm specification string classes, simple and
  363. complex.
  364. Only certain algorithms will be accepted by the TPM, based on usage and
  365. conditions.
  366. .SS Simple specifiers
  367. .PP
  368. These are strings with no additional specification data.
  369. When creating objects, non\-specified portions of an object are assumed
  370. to defaults.
  371. You can find the list of known "Simple Specifiers Below".
  372. .SS Asymmetric
  373. .IP \[bu] 2
  374. rsa
  375. .IP \[bu] 2
  376. ecc
  377. .SS Symmetric
  378. .IP \[bu] 2
  379. aes
  380. .IP \[bu] 2
  381. camellia
  382. .SS Hashing Algorithms
  383. .IP \[bu] 2
  384. sha1
  385. .IP \[bu] 2
  386. sha256
  387. .IP \[bu] 2
  388. sha384
  389. .IP \[bu] 2
  390. sha512
  391. .IP \[bu] 2
  392. sm3_256
  393. .IP \[bu] 2
  394. sha3_256
  395. .IP \[bu] 2
  396. sha3_384
  397. .IP \[bu] 2
  398. sha3_512
  399. .SS Keyed Hash
  400. .IP \[bu] 2
  401. hmac
  402. .IP \[bu] 2
  403. xor
  404. .SS Signing Schemes
  405. .IP \[bu] 2
  406. rsassa
  407. .IP \[bu] 2
  408. rsapss
  409. .IP \[bu] 2
  410. ecdsa
  411. .IP \[bu] 2
  412. ecdaa
  413. .IP \[bu] 2
  414. ecschnorr
  415. .SS Asymmetric Encryption Schemes
  416. .IP \[bu] 2
  417. oaep
  418. .IP \[bu] 2
  419. rsaes
  420. .IP \[bu] 2
  421. ecdh
  422. .SS Modes
  423. .IP \[bu] 2
  424. ctr
  425. .IP \[bu] 2
  426. ofb
  427. .IP \[bu] 2
  428. cbc
  429. .IP \[bu] 2
  430. cfb
  431. .IP \[bu] 2
  432. ecb
  433. .SS Misc
  434. .IP \[bu] 2
  435. null
  436. .SS Complex Specifiers
  437. .PP
  438. Objects, when specified for creation by the TPM, have numerous
  439. algorithms to populate in the public data.
  440. Things like type, scheme and asymmetric details, key size, etc.
  441. Below is the general format for specifying this data:
  442. \f[C]<type>:<scheme>:<symmetric\-details>\f[]
  443. .SS Type Specifiers
  444. .PP
  445. This portion of the complex algorithm specifier is required.
  446. The remaining scheme and symmetric details will default based on the
  447. type specified and the type of the object being created.
  448. .IP \[bu] 2
  449. aes \- Default AES: aes128
  450. .IP \[bu] 2
  451. aes128\f[C]<mode>\f[] \- 128 bit AES with optional mode
  452. (\f[I]ctr\f[]|\f[I]ofb\f[]|\f[I]cbc\f[]|\f[I]cfb\f[]|\f[I]ecb\f[]).
  453. If mode is not specified, defaults to \f[I]null\f[].
  454. .IP \[bu] 2
  455. aes192\f[C]<mode>\f[] \- Same as aes128\f[C]<mode>\f[], except for a 192
  456. bit key size.
  457. .IP \[bu] 2
  458. aes256\f[C]<mode>\f[] \- Same as aes128\f[C]<mode>\f[], except for a 256
  459. bit key size.
  460. .IP \[bu] 2
  461. ecc \- Elliptical Curve, defaults to ecc256.
  462. .IP \[bu] 2
  463. ecc192 \- 192 bit ECC
  464. .IP \[bu] 2
  465. ecc224 \- 224 bit ECC
  466. .IP \[bu] 2
  467. ecc256 \- 256 bit ECC
  468. .IP \[bu] 2
  469. ecc384 \- 384 bit ECC
  470. .IP \[bu] 2
  471. ecc521 \- 521 bit ECC
  472. .IP \[bu] 2
  473. rsa \- Default RSA: rsa2048
  474. .IP \[bu] 2
  475. rsa1024 \- RSA with 1024 bit keysize.
  476. .IP \[bu] 2
  477. rsa2048 \- RSA with 2048 bit keysize.
  478. .IP \[bu] 2
  479. rsa4096 \- RSA with 4096 bit keysize.
  480. .SS Scheme Specifiers
  481. .PP
  482. Next, is an optional field, it can be skipped.
  483. .PP
  484. Schemes are usually \f[B]Signing Schemes\f[] or \f[B]Asymmetric
  485. Encryption Schemes\f[].
  486. Most signing schemes take a hash algorithm directly following the
  487. signing scheme.
  488. If the hash algorithm is missing, it defaults to \f[I]sha256\f[].
  489. Some take no arguments, and some take multiple arguments.
  490. .SS Hash Optional Scheme Specifiers
  491. .PP
  492. These scheme specifiers are followed by a dash and a valid hash
  493. algorithm, For example: \f[C]oaep\-sha256\f[].
  494. .IP \[bu] 2
  495. oaep
  496. .IP \[bu] 2
  497. ecdh
  498. .IP \[bu] 2
  499. rsassa
  500. .IP \[bu] 2
  501. rsapss
  502. .IP \[bu] 2
  503. ecdsa
  504. .IP \[bu] 2
  505. ecschnorr
  506. .SS Multiple Option Scheme Specifiers
  507. .PP
  508. This scheme specifier is followed by a count (max size UINT16) then
  509. followed by a dash(\-) and a valid hash algorithm.
  510. * ecdaa For example, ecdaa4\-sha256.
  511. If no count is specified, it defaults to 4.
  512. .SS No Option Scheme Specifiers
  513. .PP
  514. This scheme specifier takes NO arguments.
  515. * rsaes
  516. .SS Symmetric Details Specifiers
  517. .PP
  518. This field is optional, and defaults based on the \f[I]type\f[] of
  519. object being created and it\[aq]s attributes.
  520. Generally, any valid \f[B]Symmetric\f[] specifier from the \f[B]Type
  521. Specifiers\f[] list should work.
  522. If not specified, an asymmetric objects symmetric details defaults to
  523. \f[I]aes128cfb\f[].
  524. .SS Examples
  525. .SS Create an rsa2048 key with an rsaes asymmetric encryption scheme
  526. .PP
  527. \f[C]tpm2_create\ \-C\ parent.ctx\ \-G\ rsa2048:rsaes\ \-u\ key.pub\ \-r\ key.priv\f[]
  528. .SS Create an ecc256 key with an ecdaa signing scheme with a count of 4
  529. and sha384 hash
  530. .PP
  531. \f[C]/tpm2_create\ \-C\ parent.ctx\ \-G\ ecc256:ecdaa4\-sha384\ \-u\ key.pub\ \-r\ key.priv\f[]
  532. cryptographic algorithms \f[I]ALGORITHM\f[].
  533. .SH Object Attributes
  534. .PP
  535. Object Attributes are used to control various properties of created
  536. objects.
  537. When specified as an option, either the raw bitfield mask or
  538. "nice\-names" may be used.
  539. The values can be found in Table 31 Part 2 of the TPM2.0 specification,
  540. which can be found here:
  541. .PP
  542. <https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-01.38.pdf>
  543. .PP
  544. Nice names are calculated by taking the name field of table 31 and
  545. removing the prefix \f[B]TPMA_OBJECT_\f[] and lowercasing the result.
  546. Thus, \f[B]TPMA_OBJECT_FIXEDTPM\f[] becomes fixedtpm.
  547. Nice names can be joined using the bitwise or "|" symbol.
  548. .PP
  549. For instance, to set The fields \f[B]TPMA_OBJECT_FIXEDTPM\f[],
  550. \f[B]TPMA_OBJECT_NODA\f[], and \f[B]TPMA_OBJECT_SIGN_ENCRYPT\f[], the
  551. argument would be:
  552. .PP
  553. \f[B]fixedtpm|noda|sign\f[] specifying the object attributes
  554. \f[I]ATTRIBUTES\f[].
  555. .SH COMMON OPTIONS
  556. .PP
  557. This collection of options are common to many programs and provide
  558. information that many users may expect.
  559. .IP \[bu] 2
  560. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  561. manpage.
  562. By default, it attempts to invoke the manpager for the tool, however, on
  563. failure will output a short tool summary.
  564. This is the same behavior if the "man" option argument is specified,
  565. however if explicit "man" is requested, the tool will provide errors
  566. from man on stderr.
  567. If the "no\-man" option if specified, or the manpager fails, the short
  568. options will be output to stdout.
  569. .RS 2
  570. .PP
  571. To successfully use the manpages feature requires the manpages to be
  572. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  573. .RE
  574. .IP \[bu] 2
  575. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  576. tool, supported tctis and exit.
  577. .IP \[bu] 2
  578. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  579. tool prints to the console during its execution.
  580. When using this option the file and line number are printed.
  581. .IP \[bu] 2
  582. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  583. .IP \[bu] 2
  584. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  585. errata fixups.
  586. Useful if an errata fixup needs to be applied to commands sent to the
  587. TPM.
  588. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  589. information many users may expect.
  590. .SH TCTI Configuration
  591. .PP
  592. The TCTI or "Transmission Interface" is the communication mechanism with
  593. the TPM.
  594. TCTIs can be changed for communication with TPMs across different
  595. mediums.
  596. .PP
  597. To control the TCTI, the tools respect:
  598. .IP "1." 3
  599. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  600. .IP "2." 3
  601. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  602. .PP
  603. \f[B]Note:\f[] The command line option always overrides the environment
  604. variable.
  605. .PP
  606. The current known TCTIs are:
  607. .IP \[bu] 2
  608. tabrmd \- The resource manager, called
  609. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  610. Note that tabrmd and abrmd as a tcti name are synonymous.
  611. .IP \[bu] 2
  612. mssim \- Typically used for communicating to the TPM software simulator.
  613. .IP \[bu] 2
  614. device \- Used when talking directly to a TPM device file.
  615. .IP \[bu] 2
  616. none \- Do not initalize a connection with the TPM.
  617. Some tools allow for off\-tpm options and thus support not using a TCTI.
  618. Tools that do not support it will error when attempted to be used
  619. without a TCTI connection.
  620. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  621. the exact text of "none".
  622. .PP
  623. The arguments to either the command line option or the environment
  624. variable are in the form:
  625. .PP
  626. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  627. .PP
  628. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  629. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  630. that portion respectively.
  631. .SS TCTI Defaults
  632. .PP
  633. When a TCTI is not specified, the default TCTI is searched for using
  634. \f[I]dlopen(3)\f[] semantics.
  635. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  636. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  637. FOUND\f[].
  638. You can query what TCTI will be chosen as the default by using the
  639. \f[B]\-v\f[] option to print the version information.
  640. The "default\-tcti" key\-value pair will indicate which of the
  641. aforementioned TCTIs is the default.
  642. .SS Custom TCTIs
  643. .PP
  644. Any TCTI that implements the dynamic TCTI interface can be loaded.
  645. The tools internally use \f[I]dlopen(3)\f[], and the raw
  646. \f[I]tcti\-name\f[] value is used for the lookup.
  647. Thus, this could be a path to the shared library, or a library name as
  648. understood by \f[I]dlopen(3)\f[] semantics.
  649. .SH TCTI OPTIONS
  650. .PP
  651. This collection of options are used to configure the various known TCTI
  652. modules available:
  653. .IP \[bu] 2
  654. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  655. use by the device TCTI can be specified.
  656. The default is \f[I]/dev/tpm0\f[].
  657. .RS 2
  658. .PP
  659. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  660. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  661. .RE
  662. .IP \[bu] 2
  663. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  664. port number used by the simulator can be specified.
  665. The default are 127.0.0.1 and 2321.
  666. .RS 2
  667. .PP
  668. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  669. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  670. .RE
  671. .IP \[bu] 2
  672. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  673. series of simple key value pairs separated by a \[aq],\[aq] character.
  674. Each key and value string are separated by a \[aq]=\[aq] character.
  675. .RS 2
  676. .IP \[bu] 2
  677. TCTI abrmd supports two keys:
  678. .RS 2
  679. .IP "1." 3
  680. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  681. string).
  682. .IP "2." 3
  683. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  684. \[aq]session\[aq] and \[aq]system\[aq].
  685. .RE
  686. .PP
  687. Specify the tabrmd tcti name and a config string of
  688. \f[C]bus_name=com.example.FooBar\f[]:
  689. .PP
  690. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  691. .PP
  692. Specify the default (abrmd) tcti and a config string of
  693. \f[C]bus_type=session\f[]:
  694. .PP
  695. \f[C]\\\-\-tcti:bus_type=session\f[]
  696. .PP
  697. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  698. the various known TCTI modules.
  699. .RE
  700. .SH EXAMPLES
  701. .SS Setup
  702. .PP
  703. In order to create an object, we must first create a primary key as
  704. it\[aq]s parent.
  705. .IP
  706. .nf
  707. \f[C]
  708. tpm2_createprimary\ \-c\ primary.ctx
  709. \f[]
  710. .fi
  711. .SS Create an Object
  712. .PP
  713. This will create an object using all the default values and store the
  714. TPM sealed private and public portions to the paths specified via \-u
  715. and \-r respectively.
  716. The tool defaults to an RSA key.
  717. .IP
  718. .nf
  719. \f[C]
  720. tpm2_create\ \-C\ primary.ctx\ \-u\ obj.pub\ \-r\ obj.priv
  721. \f[]
  722. .fi
  723. .SS Seal Data to the TPM
  724. .PP
  725. Outside of key objects, the TPM allows for small amounts of user
  726. specified data to be sealed to the TPM.
  727. .IP
  728. .nf
  729. \f[C]
  730. echo\ "my\ sealed\ data"\ >\ seal.dat
  731. tpm2_create\ \-C\ primary.ctx\ \-i\ seal.dat\ \-u\ obj.pub\ \-r\ obj.priv
  732. \f[]
  733. .fi
  734. .SS Create an EC Key Object and Load it to the TPM
  735. .PP
  736. Normally, when creating an object, only the public and private portions
  737. of the object are returned and the caller needs to use tpm2_load(1) to
  738. load those public and private portions to the TPM before being able to
  739. use the object.
  740. However, this can be accomplished within this command as well, when
  741. supported by the TPM.
  742. You can verify your TPM supports this feature by checking that
  743. tpm2_getcap(1) commands returns TPM2_CC_CreateLoaded in the command set.
  744. If your TPM does not support TPM2_CC_CreateLoaded an unsuported command
  745. code error will be returned.
  746. If it\[aq]s not supported one must use tpm2_load(1).
  747. See that manpage for details on its usage.
  748. .IP
  749. .nf
  750. \f[C]
  751. tpm2_create\ \-C\ primary.ctx\ \-G\ ecc\ \-u\ obj.pub\ \-r\ obj.priv\ \-c\ ecc.ctx
  752. \f[]
  753. .fi
  754. .SH Returns
  755. .PP
  756. Tools can return any of the following codes:
  757. .IP \[bu] 2
  758. 0 \- Success.
  759. .IP \[bu] 2
  760. 1 \- General non\-specific error.
  761. .IP \[bu] 2
  762. 2 \- Options handling error.
  763. .IP \[bu] 2
  764. 3 \- Authentication error.
  765. .IP \[bu] 2
  766. 4 \- TCTI related error.
  767. .IP \[bu] 2
  768. 5 \- Non supported scheme.
  769. Applicable to tpm2_testparams.
  770. .SH BUGS
  771. .PP
  772. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  773. .SH HELP
  774. .PP
  775. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)