tpm2_loadexternal.1 20 KB

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