tpm2_sign.1 18 KB

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