tpm2_policyticket.1 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_ticket" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_ticket\f[](1) \- Enables policy authorization by verifying a
  8. ticket that represents a validated authorization that had an expiration
  9. time associated with it.
  10. .SH SYNOPSIS
  11. .PP
  12. \f[B]tpm2_ticket\f[] [\f[I]OPTIONS\f[]]
  13. .SH DESCRIPTION
  14. .PP
  15. \f[B]tpm2_ticket\f[](1) \- Enables policy authorization by verifying a
  16. ticket that represents a validated authorization that had an expiration
  17. time associated with it.
  18. .SH OPTIONS
  19. .IP \[bu] 2
  20. \f[B]\-L\f[], \f[B]\-\-policy\f[]=\f[I]FILE\f[]:
  21. .RS 2
  22. .PP
  23. File to save the compounded policy digest.
  24. .RE
  25. .IP \[bu] 2
  26. \f[B]\-S\f[], \f[B]\-\-session\f[]=\f[I]FILE\f[]:
  27. .RS 2
  28. .PP
  29. The policy session file generated via the \f[B]\-S\f[] option to
  30. \f[B]tpm2_startauthsession\f[](1).
  31. .RE
  32. .IP \[bu] 2
  33. \f[B]\-n\f[], \f[B]\-\-name\f[]=\f[I]FILE\f[]:
  34. .RS 2
  35. .PP
  36. Name of the object that validated the authorization.
  37. .RE
  38. .IP \[bu] 2
  39. \f[B]\-\-ticket\f[]=\f[I]FILE\f[]:
  40. .RS 2
  41. .PP
  42. The ticket file to record the authorization ticket structure.
  43. .RE
  44. .IP \[bu] 2
  45. \f[B]\-\-timeout\f[]=\f[I]FILE\f[]:
  46. .RS 2
  47. .PP
  48. The file path to record the timeout structure returned.
  49. .RE
  50. .IP \[bu] 2
  51. \f[B]\-q\f[], \f[B]\-\-qualification\f[]=\f[I]FILE_OR_HEX_STR\f[]:
  52. .RS 2
  53. .PP
  54. Optional, the policy qualifier data that the signer can choose to
  55. include in the signature.
  56. Can be either a hex string or path.
  57. .RE
  58. .SS References
  59. .SH COMMON OPTIONS
  60. .PP
  61. This collection of options are common to many programs and provide
  62. information that many users may expect.
  63. .IP \[bu] 2
  64. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  65. manpage.
  66. By default, it attempts to invoke the manpager for the tool, however, on
  67. failure will output a short tool summary.
  68. This is the same behavior if the "man" option argument is specified,
  69. however if explicit "man" is requested, the tool will provide errors
  70. from man on stderr.
  71. If the "no\-man" option if specified, or the manpager fails, the short
  72. options will be output to stdout.
  73. .RS 2
  74. .PP
  75. To successfully use the manpages feature requires the manpages to be
  76. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  77. .RE
  78. .IP \[bu] 2
  79. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  80. tool, supported tctis and exit.
  81. .IP \[bu] 2
  82. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  83. tool prints to the console during its execution.
  84. When using this option the file and line number are printed.
  85. .IP \[bu] 2
  86. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  87. .IP \[bu] 2
  88. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  89. errata fixups.
  90. Useful if an errata fixup needs to be applied to commands sent to the
  91. TPM.
  92. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  93. information many users may expect.
  94. .SH TCTI Configuration
  95. .PP
  96. The TCTI or "Transmission Interface" is the communication mechanism with
  97. the TPM.
  98. TCTIs can be changed for communication with TPMs across different
  99. mediums.
  100. .PP
  101. To control the TCTI, the tools respect:
  102. .IP "1." 3
  103. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  104. .IP "2." 3
  105. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  106. .PP
  107. \f[B]Note:\f[] The command line option always overrides the environment
  108. variable.
  109. .PP
  110. The current known TCTIs are:
  111. .IP \[bu] 2
  112. tabrmd \- The resource manager, called
  113. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  114. Note that tabrmd and abrmd as a tcti name are synonymous.
  115. .IP \[bu] 2
  116. mssim \- Typically used for communicating to the TPM software simulator.
  117. .IP \[bu] 2
  118. device \- Used when talking directly to a TPM device file.
  119. .IP \[bu] 2
  120. none \- Do not initalize a connection with the TPM.
  121. Some tools allow for off\-tpm options and thus support not using a TCTI.
  122. Tools that do not support it will error when attempted to be used
  123. without a TCTI connection.
  124. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  125. the exact text of "none".
  126. .PP
  127. The arguments to either the command line option or the environment
  128. variable are in the form:
  129. .PP
  130. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  131. .PP
  132. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  133. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  134. that portion respectively.
  135. .SS TCTI Defaults
  136. .PP
  137. When a TCTI is not specified, the default TCTI is searched for using
  138. \f[I]dlopen(3)\f[] semantics.
  139. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  140. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  141. FOUND\f[].
  142. You can query what TCTI will be chosen as the default by using the
  143. \f[B]\-v\f[] option to print the version information.
  144. The "default\-tcti" key\-value pair will indicate which of the
  145. aforementioned TCTIs is the default.
  146. .SS Custom TCTIs
  147. .PP
  148. Any TCTI that implements the dynamic TCTI interface can be loaded.
  149. The tools internally use \f[I]dlopen(3)\f[], and the raw
  150. \f[I]tcti\-name\f[] value is used for the lookup.
  151. Thus, this could be a path to the shared library, or a library name as
  152. understood by \f[I]dlopen(3)\f[] semantics.
  153. .SH TCTI OPTIONS
  154. .PP
  155. This collection of options are used to configure the various known TCTI
  156. modules available:
  157. .IP \[bu] 2
  158. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  159. use by the device TCTI can be specified.
  160. The default is \f[I]/dev/tpm0\f[].
  161. .RS 2
  162. .PP
  163. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  164. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  165. .RE
  166. .IP \[bu] 2
  167. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  168. port number used by the simulator can be specified.
  169. The default are 127.0.0.1 and 2321.
  170. .RS 2
  171. .PP
  172. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  173. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  174. .RE
  175. .IP \[bu] 2
  176. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  177. series of simple key value pairs separated by a \[aq],\[aq] character.
  178. Each key and value string are separated by a \[aq]=\[aq] character.
  179. .RS 2
  180. .IP \[bu] 2
  181. TCTI abrmd supports two keys:
  182. .RS 2
  183. .IP "1." 3
  184. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  185. string).
  186. .IP "2." 3
  187. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  188. \[aq]session\[aq] and \[aq]system\[aq].
  189. .RE
  190. .PP
  191. Specify the tabrmd tcti name and a config string of
  192. \f[C]bus_name=com.example.FooBar\f[]:
  193. .PP
  194. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  195. .PP
  196. Specify the default (abrmd) tcti and a config string of
  197. \f[C]bus_type=session\f[]:
  198. .PP
  199. \f[C]\\\-\-tcti:bus_type=session\f[]
  200. .PP
  201. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  202. the various known TCTI modules.
  203. .RE
  204. .SH EXAMPLES
  205. .PP
  206. Authorize a TPM operation on an object whose authorization is bound to
  207. specific signing authority.
  208. .SS Create the signing authority and load the verification key
  209. .IP
  210. .nf
  211. \f[C]
  212. openssl\ genrsa\ \-out\ private.pem\ 2048
  213. openssl\ rsa\ \-in\ private.pem\ \-outform\ PEM\ \-pubout\ \-out\ public.pem
  214. tpm2_loadexternal\ \-C\ o\ \-G\ rsa\ \-u\ public.pem\ \-c\ signing_key.ctx\ \\
  215. \-n\ signing_key.name
  216. \f[]
  217. .fi
  218. .SS Generate signature with the expiry time
  219. .IP
  220. .nf
  221. \f[C]
  222. EXPIRYTIME="FFFFFE0C"
  223. echo\ $EXPIRYTIME\ |\ xxd\ \-r\ \-p\ |\ \\
  224. openssl\ dgst\ \-sha256\ \-sign\ private.pem\ \-out\ signature.dat
  225. \f[]
  226. .fi
  227. .SS Create the policy
  228. .IP
  229. .nf
  230. \f[C]
  231. tpm2_startauthsession\ \-S\ session.ctx
  232. tpm2_policysigned\ \-S\ session.ctx\ \-g\ sha256\ \-s\ signature.dat\ \-f\ rsassa\ \\
  233. \-c\ signing_key.ctx\ \-L\ policy.signed
  234. tpm2_flushcontext\ session.ctx
  235. \f[]
  236. .fi
  237. .SS Create a sealing object
  238. .IP
  239. .nf
  240. \f[C]
  241. tpm2_createprimary\ \-C\ o\ \-c\ prim.ctx\ \-Q
  242. echo\ "plaintext"\ >\ secret.dat
  243. tpm2_create\ \-u\ sealing_key.pub\ \-r\ sealing_key.priv\ \-c\ sealing_key.ctx\ \\
  244. \-C\ prim.ctx\ \-i\ secret.dat\ \-L\ policy.signed\ \-Q
  245. \f[]
  246. .fi
  247. .SS Create ticket\-able policy
  248. .IP
  249. .nf
  250. \f[C]
  251. tpm2_startauthsession\ \-S\ session.ctx\ \-\-nonce\-tpm=nonce.test\ \-\-policy\-session
  252. {\ cat\ nonce.test\ &\ echo\ $EXPIRYTIME\ |\ xxd\ \-r\ \-p;\ }\ |\ \\
  253. openssl\ dgst\ \-sha256\ \-sign\ private.pem\ \-out\ signature.dat
  254. tpm2_policysigned\ \-S\ session.ctx\ \-g\ sha256\ \-s\ signature.dat\ \-f\ rsassa\ \\
  255. \-c\ signing_key.ctx\ \-x\ nonce.test\ \-\-ticket\ tic.ket\ \-\-timeout\ time.out\ \\
  256. \-t\ 0xFFFFFE0C
  257. tpm2_flushcontext\ session.ctx
  258. \f[]
  259. .fi
  260. .SS Test with policyticket instead of policysigned
  261. .IP
  262. .nf
  263. \f[C]
  264. tpm2_startauthsession\ \-S\ session.ctx\ \-\-policy\-session
  265. tpm2_policyticket\ \-S\ session.ctx\ \-n\ signing_key.name\ \-\-ticket\ tic.ket\ \\
  266. \-\-timeout\ time.out
  267. tpm2_unseal\ \-p\ session:session.ctx\ \-c\ sealing_key.ctx
  268. \f[]
  269. .fi
  270. .SH Returns
  271. .PP
  272. Tools can return any of the following codes:
  273. .IP \[bu] 2
  274. 0 \- Success.
  275. .IP \[bu] 2
  276. 1 \- General non\-specific error.
  277. .IP \[bu] 2
  278. 2 \- Options handling error.
  279. .IP \[bu] 2
  280. 3 \- Authentication error.
  281. .IP \[bu] 2
  282. 4 \- TCTI related error.
  283. .IP \[bu] 2
  284. 5 \- Non supported scheme.
  285. Applicable to tpm2_testparams.
  286. .SH Limitations
  287. .PP
  288. It expects a session to be already established via
  289. \f[B]tpm2_startauthsession\f[](1) and requires one of the following:
  290. .IP \[bu] 2
  291. direct device access
  292. .IP \[bu] 2
  293. extended session support with \f[B]tpm2\-abrmd\f[].
  294. .PP
  295. Without it, most resource managers \f[B]will not\f[] save session state
  296. between command invocations.
  297. .SH BUGS
  298. .PP
  299. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  300. .SH HELP
  301. .PP
  302. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)