tpm2_policysigned.1 10 KB

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