tpm2_print.1 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_print" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_print\f[](1) \- Prints TPM data structures
  8. .SH SYNOPSIS
  9. .PP
  10. \f[B]tpm2_print\f[] [\f[I]OPTIONS\f[]] [\f[I]ARGUMENT\f[] or
  11. \f[I]STDIN\f[]]
  12. .SH DESCRIPTION
  13. .PP
  14. \f[B]tpm2_print\f[](1) \- Decodes a TPM data structure and prints
  15. enclosed elements to stdout as YAML.
  16. A file path containing a TPM object may be specified as the path
  17. argument.
  18. Reads from stdin if unspecified.
  19. .SH OPTIONS
  20. .IP \[bu] 2
  21. \f[B]\-t\f[], \f[B]\-\-type\f[]:
  22. .RS 2
  23. Required.
  24. Type of data structure.
  25. The option supports the following arguments:
  26. .IP \[bu] 2
  27. \f[B]TPMS_ATTEST\f[]
  28. .IP \[bu] 2
  29. \f[B]TPMS_CONTEXT\f[]
  30. .IP \[bu] 2
  31. \f[B]TPM2B_PUBLIC\f[]
  32. .IP \[bu] 2
  33. \f[B]TPMT_PUBLIC\f[]
  34. .RE
  35. .IP \[bu] 2
  36. \f[B]ARGUMENT\f[] the command line argument specifies the path of the
  37. TPM data.
  38. .SS References
  39. .SH Context Object Format
  40. .PP
  41. The type of a context object, whether it is a handle or file name, is
  42. determined according to the following logic \f[I]in\-order\f[]:
  43. .IP \[bu] 2
  44. If the argument is a file path, then the file is loaded as a restored
  45. TPM transient object.
  46. .IP \[bu] 2
  47. If the argument is a \f[I]prefix\f[] match on one of:
  48. .RS 2
  49. .IP \[bu] 2
  50. owner: the owner hierarchy
  51. .IP \[bu] 2
  52. platform: the platform hierarchy
  53. .IP \[bu] 2
  54. endorsement: the endorsement hierarchy
  55. .IP \[bu] 2
  56. lockout: the lockout control persistent object
  57. .RE
  58. .IP \[bu] 2
  59. If the argument argument can be loaded as a number it will be treat as a
  60. handle, e.g.
  61. 0x81010013 and used directly.\f[I]OBJECT\f[].
  62. .SH Authorization Formatting
  63. .PP
  64. Authorization for use of an object in TPM2.0 can come in 3 different
  65. forms: 1.
  66. Password 2.
  67. HMAC 3.
  68. Sessions
  69. .PP
  70. \f[B]NOTE:\f[] "Authorizations default to the \f[B]EMPTY PASSWORD\f[]
  71. when not specified".
  72. .SS Passwords
  73. .PP
  74. Passwords are interpreted in the following forms below using prefix
  75. identifiers.
  76. .PP
  77. \f[B]Note\f[]: By default passwords are assumed to be in the string form
  78. when they do not have a prefix.
  79. .SS String
  80. .PP
  81. A string password, specified by prefix "str:" or it\[aq]s absence (raw
  82. string without prefix) is not interpreted, and is directly used for
  83. authorization.
  84. .SS Examples
  85. .IP
  86. .nf
  87. \f[C]
  88. foobar
  89. str:foobar
  90. \f[]
  91. .fi
  92. .SS Hex\-string
  93. .PP
  94. A hex\-string password, specified by prefix "hex:" is converted from a
  95. hexidecimal form into a byte array form, thus allowing passwords with
  96. non\-printable and/or terminal un\-friendly characters.
  97. .SS Example
  98. .IP
  99. .nf
  100. \f[C]
  101. hex:0x1122334455667788
  102. \f[]
  103. .fi
  104. .SS File
  105. .PP
  106. A file based password, specified be prefix "file:" should be the path of
  107. a file containing the password to be read by the tool or a "\-" to use
  108. stdin.
  109. Storing passwords in files prevents information leakage, passwords
  110. passed as options can be read from the process list or common shell
  111. history features.
  112. .SS Examples
  113. .IP
  114. .nf
  115. \f[C]
  116. #\ to\ use\ stdin\ and\ be\ prompted
  117. file:\-
  118. #\ to\ use\ a\ file\ from\ a\ path
  119. file:path/to/password/file
  120. #\ to\ echo\ a\ password\ via\ stdin:
  121. echo\ foobar\ |\ tpm2_tool\ \-p\ file:\-
  122. #\ to\ use\ a\ bash\ here\-string\ via\ stdin:
  123. tpm2_tool\ \-p\ file:\-\ <<<\ foobar
  124. \f[]
  125. .fi
  126. .SS Sessions
  127. .PP
  128. When using a policy session to authorize the use of an object, prefix
  129. the option argument with the \f[I]session\f[] keyword.
  130. Then indicate a path to a session file that was created with
  131. tpm2_startauthsession(1).
  132. Optionally, if the session requires an auth value to be sent with the
  133. session handle (eg policy password), then append a + and a string as
  134. described in the \f[B]Passwords\f[] section.
  135. .SS Examples
  136. .PP
  137. To use a session context file called \f[I]session.ctx\f[].
  138. .IP
  139. .nf
  140. \f[C]
  141. session:session.ctx
  142. \f[]
  143. .fi
  144. .PP
  145. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  146. send the authvalue mypassword.
  147. .IP
  148. .nf
  149. \f[C]
  150. session:session.ctx+mypassword
  151. \f[]
  152. .fi
  153. .PP
  154. To use a session context file called \f[I]session.ctx\f[] \f[B]AND\f[]
  155. send the \f[I]HEX\f[] authvalue 0x11223344.
  156. .IP
  157. .nf
  158. \f[C]
  159. session:session.ctx+hex:11223344
  160. \f[]
  161. .fi
  162. .SS PCR Authorizations
  163. .PP
  164. You can satisfy a PCR policy using the "pcr:" prefix and the PCR
  165. minilanguage.
  166. The PCR minilanguage is as follows:
  167. \f[C]<pcr\-spec>=<raw\-pcr\-file>\f[]
  168. .PP
  169. The PCR spec is documented in in the section "PCR bank specifiers".
  170. .PP
  171. The \f[C]raw\-pcr\-file\f[] is an \f[B]optional\f[] the output of the
  172. raw PCR contents as returned by \f[I]tpm2_pcrread(1)\f[].
  173. .PP
  174. PCR bank specifiers (common/pcr.md)
  175. .SS Examples
  176. .PP
  177. To satisfy a PCR policy of sha256 on banks 0, 1, 2 and 3 use a specifier
  178. of:
  179. .IP
  180. .nf
  181. \f[C]
  182. pcr:sha256:0,1,2,3
  183. \f[]
  184. .fi
  185. .PP
  186. specifying \f[I]AUTH\f[].
  187. .SH COMMON OPTIONS
  188. .PP
  189. This collection of options are common to many programs and provide
  190. information that many users may expect.
  191. .IP \[bu] 2
  192. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  193. manpage.
  194. By default, it attempts to invoke the manpager for the tool, however, on
  195. failure will output a short tool summary.
  196. This is the same behavior if the "man" option argument is specified,
  197. however if explicit "man" is requested, the tool will provide errors
  198. from man on stderr.
  199. If the "no\-man" option if specified, or the manpager fails, the short
  200. options will be output to stdout.
  201. .RS 2
  202. .PP
  203. To successfully use the manpages feature requires the manpages to be
  204. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  205. .RE
  206. .IP \[bu] 2
  207. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  208. tool, supported tctis and exit.
  209. .IP \[bu] 2
  210. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  211. tool prints to the console during its execution.
  212. When using this option the file and line number are printed.
  213. .IP \[bu] 2
  214. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  215. .IP \[bu] 2
  216. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  217. errata fixups.
  218. Useful if an errata fixup needs to be applied to commands sent to the
  219. TPM.
  220. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  221. information many users may expect.
  222. .SH TCTI Configuration
  223. .PP
  224. The TCTI or "Transmission Interface" is the communication mechanism with
  225. the TPM.
  226. TCTIs can be changed for communication with TPMs across different
  227. mediums.
  228. .PP
  229. To control the TCTI, the tools respect:
  230. .IP "1." 3
  231. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  232. .IP "2." 3
  233. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  234. .PP
  235. \f[B]Note:\f[] The command line option always overrides the environment
  236. variable.
  237. .PP
  238. The current known TCTIs are:
  239. .IP \[bu] 2
  240. tabrmd \- The resource manager, called
  241. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  242. Note that tabrmd and abrmd as a tcti name are synonymous.
  243. .IP \[bu] 2
  244. mssim \- Typically used for communicating to the TPM software simulator.
  245. .IP \[bu] 2
  246. device \- Used when talking directly to a TPM device file.
  247. .IP \[bu] 2
  248. none \- Do not initalize a connection with the TPM.
  249. Some tools allow for off\-tpm options and thus support not using a TCTI.
  250. Tools that do not support it will error when attempted to be used
  251. without a TCTI connection.
  252. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  253. the exact text of "none".
  254. .PP
  255. The arguments to either the command line option or the environment
  256. variable are in the form:
  257. .PP
  258. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  259. .PP
  260. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  261. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  262. that portion respectively.
  263. .SS TCTI Defaults
  264. .PP
  265. When a TCTI is not specified, the default TCTI is searched for using
  266. \f[I]dlopen(3)\f[] semantics.
  267. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  268. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  269. FOUND\f[].
  270. You can query what TCTI will be chosen as the default by using the
  271. \f[B]\-v\f[] option to print the version information.
  272. The "default\-tcti" key\-value pair will indicate which of the
  273. aforementioned TCTIs is the default.
  274. .SS Custom TCTIs
  275. .PP
  276. Any TCTI that implements the dynamic TCTI interface can be loaded.
  277. The tools internally use \f[I]dlopen(3)\f[], and the raw
  278. \f[I]tcti\-name\f[] value is used for the lookup.
  279. Thus, this could be a path to the shared library, or a library name as
  280. understood by \f[I]dlopen(3)\f[] semantics.
  281. .SH TCTI OPTIONS
  282. .PP
  283. This collection of options are used to configure the various known TCTI
  284. modules available:
  285. .IP \[bu] 2
  286. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  287. use by the device TCTI can be specified.
  288. The default is \f[I]/dev/tpm0\f[].
  289. .RS 2
  290. .PP
  291. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  292. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  293. .RE
  294. .IP \[bu] 2
  295. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  296. port number used by the simulator can be specified.
  297. The default are 127.0.0.1 and 2321.
  298. .RS 2
  299. .PP
  300. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  301. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  302. .RE
  303. .IP \[bu] 2
  304. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  305. series of simple key value pairs separated by a \[aq],\[aq] character.
  306. Each key and value string are separated by a \[aq]=\[aq] character.
  307. .RS 2
  308. .IP \[bu] 2
  309. TCTI abrmd supports two keys:
  310. .RS 2
  311. .IP "1." 3
  312. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  313. string).
  314. .IP "2." 3
  315. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  316. \[aq]session\[aq] and \[aq]system\[aq].
  317. .RE
  318. .PP
  319. Specify the tabrmd tcti name and a config string of
  320. \f[C]bus_name=com.example.FooBar\f[]:
  321. .PP
  322. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  323. .PP
  324. Specify the default (abrmd) tcti and a config string of
  325. \f[C]bus_type=session\f[]:
  326. .PP
  327. \f[C]\\\-\-tcti:bus_type=session\f[]
  328. .PP
  329. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  330. the various known TCTI modules.
  331. .RE
  332. .SS References
  333. .SH COMMON OPTIONS
  334. .PP
  335. This collection of options are common to many programs and provide
  336. information that many users may expect.
  337. .IP \[bu] 2
  338. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  339. manpage.
  340. By default, it attempts to invoke the manpager for the tool, however, on
  341. failure will output a short tool summary.
  342. This is the same behavior if the "man" option argument is specified,
  343. however if explicit "man" is requested, the tool will provide errors
  344. from man on stderr.
  345. If the "no\-man" option if specified, or the manpager fails, the short
  346. options will be output to stdout.
  347. .RS 2
  348. .PP
  349. To successfully use the manpages feature requires the manpages to be
  350. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  351. .RE
  352. .IP \[bu] 2
  353. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  354. tool, supported tctis and exit.
  355. .IP \[bu] 2
  356. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  357. tool prints to the console during its execution.
  358. When using this option the file and line number are printed.
  359. .IP \[bu] 2
  360. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  361. .IP \[bu] 2
  362. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  363. errata fixups.
  364. Useful if an errata fixup needs to be applied to commands sent to the
  365. TPM.
  366. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  367. information many users may expect.
  368. .SH TCTI Configuration
  369. .PP
  370. The TCTI or "Transmission Interface" is the communication mechanism with
  371. the TPM.
  372. TCTIs can be changed for communication with TPMs across different
  373. mediums.
  374. .PP
  375. To control the TCTI, the tools respect:
  376. .IP "1." 3
  377. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  378. .IP "2." 3
  379. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  380. .PP
  381. \f[B]Note:\f[] The command line option always overrides the environment
  382. variable.
  383. .PP
  384. The current known TCTIs are:
  385. .IP \[bu] 2
  386. tabrmd \- The resource manager, called
  387. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  388. Note that tabrmd and abrmd as a tcti name are synonymous.
  389. .IP \[bu] 2
  390. mssim \- Typically used for communicating to the TPM software simulator.
  391. .IP \[bu] 2
  392. device \- Used when talking directly to a TPM device file.
  393. .IP \[bu] 2
  394. none \- Do not initalize a connection with the TPM.
  395. Some tools allow for off\-tpm options and thus support not using a TCTI.
  396. Tools that do not support it will error when attempted to be used
  397. without a TCTI connection.
  398. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  399. the exact text of "none".
  400. .PP
  401. The arguments to either the command line option or the environment
  402. variable are in the form:
  403. .PP
  404. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  405. .PP
  406. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  407. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  408. that portion respectively.
  409. .SS TCTI Defaults
  410. .PP
  411. When a TCTI is not specified, the default TCTI is searched for using
  412. \f[I]dlopen(3)\f[] semantics.
  413. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  414. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  415. FOUND\f[].
  416. You can query what TCTI will be chosen as the default by using the
  417. \f[B]\-v\f[] option to print the version information.
  418. The "default\-tcti" key\-value pair will indicate which of the
  419. aforementioned TCTIs is the default.
  420. .SS Custom TCTIs
  421. .PP
  422. Any TCTI that implements the dynamic TCTI interface can be loaded.
  423. The tools internally use \f[I]dlopen(3)\f[], and the raw
  424. \f[I]tcti\-name\f[] value is used for the lookup.
  425. Thus, this could be a path to the shared library, or a library name as
  426. understood by \f[I]dlopen(3)\f[] semantics.
  427. .SH TCTI OPTIONS
  428. .PP
  429. This collection of options are used to configure the various known TCTI
  430. modules available:
  431. .IP \[bu] 2
  432. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  433. use by the device TCTI can be specified.
  434. The default is \f[I]/dev/tpm0\f[].
  435. .RS 2
  436. .PP
  437. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  438. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  439. .RE
  440. .IP \[bu] 2
  441. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  442. port number used by the simulator can be specified.
  443. The default are 127.0.0.1 and 2321.
  444. .RS 2
  445. .PP
  446. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  447. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  448. .RE
  449. .IP \[bu] 2
  450. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  451. series of simple key value pairs separated by a \[aq],\[aq] character.
  452. Each key and value string are separated by a \[aq]=\[aq] character.
  453. .RS 2
  454. .IP \[bu] 2
  455. TCTI abrmd supports two keys:
  456. .RS 2
  457. .IP "1." 3
  458. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  459. string).
  460. .IP "2." 3
  461. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  462. \[aq]session\[aq] and \[aq]system\[aq].
  463. .RE
  464. .PP
  465. Specify the tabrmd tcti name and a config string of
  466. \f[C]bus_name=com.example.FooBar\f[]:
  467. .PP
  468. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  469. .PP
  470. Specify the default (abrmd) tcti and a config string of
  471. \f[C]bus_type=session\f[]:
  472. .PP
  473. \f[C]\\\-\-tcti:bus_type=session\f[]
  474. .PP
  475. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  476. the various known TCTI modules.
  477. .RE
  478. .SH EXAMPLES
  479. .SS Print a TPM Quote
  480. .SS Setup a key to generate a qoute from
  481. .IP
  482. .nf
  483. \f[C]
  484. tpm2_createprimary\ \-C\ e\ \-c\ primary.ctx
  485. tpm2_create\ \-C\ primary.ctx\ \-u\ key.pub\ \-r\ key.priv
  486. tpm2_load\ \-C\ primary.ctx\ \-u\ key.pub\ \-r\ key.priv\ \-c\ key.ctx
  487. tpm2_quote\ \-c\ key.ctx\ \-l\ 0x0004:16,17,18+0x000b:16,17,18\ \-g\ sha256\ \-m\ msg.dat
  488. \f[]
  489. .fi
  490. .SS Print a Quote
  491. .IP
  492. .nf
  493. \f[C]
  494. tpm2_print\ \-t\ TPMS_ATTEST\ msg.dat
  495. \f[]
  496. .fi
  497. .SS Print a public file
  498. .IP
  499. .nf
  500. \f[C]
  501. tpm2_print\ \-t\ TPM2B_PUBLIC\ key.pub
  502. \f[]
  503. .fi
  504. .SS Print a tpmt public file
  505. .IP
  506. .nf
  507. \f[C]
  508. tpm2_readpublic\ \-c\ key.ctx\ \-f\ tpmt\ \-o\ key.tpmt
  509. tpm2_print\ \-t\ TPMT_PUBLIC\ key.tpmt
  510. \f[]
  511. .fi
  512. .SH Returns
  513. .PP
  514. Tools can return any of the following codes:
  515. .IP \[bu] 2
  516. 0 \- Success.
  517. .IP \[bu] 2
  518. 1 \- General non\-specific error.
  519. .IP \[bu] 2
  520. 2 \- Options handling error.
  521. .IP \[bu] 2
  522. 3 \- Authentication error.
  523. .IP \[bu] 2
  524. 4 \- TCTI related error.
  525. .IP \[bu] 2
  526. 5 \- Non supported scheme.
  527. Applicable to tpm2_testparams.
  528. .SH BUGS
  529. .PP
  530. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  531. .SH HELP
  532. .PP
  533. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)