tpm2_import.1 20 KB

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