tpm2_encryptdecrypt.1 16 KB

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