1tpm2_ecdhzgen(1) General Commands Manual tpm2_ecdhzgen(1)
2
3
4
6 tpm2_ecdhzgen(1) - Recovers the shared secret value (Z) from a public
7 point and a specified private key.
8
10 tpm2_ecdhzgen [OPTIONS]
11
13 tpm2_ecdhzgen(1) - Recovers the shared secret value (Z) from a public
14 point and a specified private key. It will perform the multiplication
15 of the provided inPoint (QB) with the private key (ds) and return the
16 coordinates of the resultant point (Z = (xZ , yZ) ≔ [hds]QB; where h is
17 the cofactor of the curve).
18
20 • -c, --key-context=FILE:
21
22 Context object pointing to ECC key. Either a file or a handle num‐
23 ber. See section “Context Object Format”.
24
25 • -p, --key-auth=AUTH:
26
27 The authorization value for the ECC key object.
28
29 • -u, --public=FILE:
30
31 Output ECC point Q.
32
33 • -o, --output=FILE
34
35 Specify file path to save the calculated ecdh secret or Z point.
36
37 • --cphash=FILE
38
39 File path to record the hash of the command parameters. This is com‐
40 monly termed as cpHash. NOTE: When this option is selected, The tool
41 will not actually execute the command, it simply returns a cpHash.
42
43 References
45 Options that take algorithms support “nice-names”.
46
47 There are two major algorithm specification string classes, simple and
48 complex. Only certain algorithms will be accepted by the TPM, based on
49 usage and conditions.
50
51 Simple specifiers
52 These are strings with no additional specification data. When creating
53 objects, non-specified portions of an object are assumed to defaults.
54 You can find the list of known “Simple Specifiers” below.
55
56 Asymmetric
57 • rsa
58
59 • ecc
60
61 Symmetric
62 • aes
63
64 • camellia
65
66 • sm4
67
68 Hashing Algorithms
69 • sha1
70
71 • sha256
72
73 • sha384
74
75 • sha512
76
77 • sm3_256
78
79 • sha3_256
80
81 • sha3_384
82
83 • sha3_512
84
85 Keyed Hash
86 • hmac
87
88 • xor
89
90 Signing Schemes
91 • rsassa
92
93 • rsapss
94
95 • ecdsa
96
97 • ecdaa
98
99 • ecschnorr
100
101 • sm2
102
103 Asymmetric Encryption Schemes
104 • oaep
105
106 • rsaes
107
108 • ecdh
109
110 Modes
111 • ctr
112
113 • ofb
114
115 • cbc
116
117 • cfb
118
119 • ecb
120
121 Misc
122 • null
123
124 Complex Specifiers
125 Objects, when specified for creation by the TPM, have numerous algo‐
126 rithms to populate in the public data. Things like type, scheme and
127 asymmetric details, key size, etc. Below is the general format for
128 specifying this data: <type>:<scheme>:<symmetric-details>
129
130 Type Specifiers
131 This portion of the complex algorithm specifier is required. The re‐
132 maining scheme and symmetric details will default based on the type
133 specified and the type of the object being created.
134
135 • aes - Default AES: aes128
136
137 • aes128<mode> - 128 bit AES with optional mode (ctr|ofb|cbc|cfb|ecb).
138 If mode is not specified, defaults to null.
139
140 • aes192<mode> - Same as aes128<mode>, except for a 192 bit key size.
141
142 • aes256<mode> - Same as aes128<mode>, except for a 256 bit key size.
143
144 • sm4 - Default SM4: sm4128
145
146 • sm4128 or sm4_128 <mode> - 128 bit SM4 with optional mode
147 (ctr|ofb|cbc|cfb|ecb). If mode is not specified, defaults to null.
148
149 • ecc - Elliptical Curve, defaults to ecc256.
150
151 • ecc192 or ecc_nist_p192 - 192 bit ECC NIST curve
152
153 • ecc224 or ecc_nist_p224 - 224 bit ECC NIST curve
154
155 • ecc256 or ecc_nist_p256 - 256 bit ECC NIST curve
156
157 • ecc384 or ecc_nist_p384 - 384 bit ECC NIST curve
158
159 • ecc521 or ecc_nist_p521 - 521 bit ECC NIST curve
160
161 • ecc_sm2 or ecc_sm2_p256 - 256 bit SM2 curve
162
163 • rsa - Default RSA: rsa2048
164
165 • rsa1024 - RSA with 1024 bit keysize.
166
167 • rsa2048 - RSA with 2048 bit keysize.
168
169 • rsa3072 - RSA with 3072 bit keysize.
170
171 • rsa4096 - RSA with 4096 bit keysize.
172
173 Scheme Specifiers
174 Next, is an optional field, it can be skipped.
175
176 Schemes are usually Signing Schemes or Asymmetric Encryption Schemes.
177 Most signing schemes take a hash algorithm directly following the sign‐
178 ing scheme. If the hash algorithm is missing, it defaults to sha256.
179 Some take no arguments, and some take multiple arguments.
180
181 Hash Optional Scheme Specifiers
182 These scheme specifiers are followed by a dash and a valid hash algo‐
183 rithm, For example: oaep-sha256.
184
185 • oaep
186
187 • ecdh
188
189 • rsassa
190
191 • rsapss
192
193 • ecdsa
194
195 • ecschnorr
196
197 • sm2
198
199 Multiple Option Scheme Specifiers
200 This scheme specifier is followed by a count (max size UINT16) then
201 followed by a dash(-) and a valid hash algorithm. * ecdaa For example,
202 ecdaa4-sha256. If no count is specified, it defaults to 4.
203
204 No Option Scheme Specifiers
205 This scheme specifier takes NO arguments. * rsaes
206
207 Symmetric Details Specifiers
208 This field is optional, and defaults based on the type of object being
209 created and it’s attributes. Generally, any valid Symmetric specifier
210 from the Type Specifiers list should work. If not specified, an asym‐
211 metric objects symmetric details defaults to aes128cfb.
212
213 Examples
214 Create an rsa2048 key with an rsaes asymmetric encryption scheme
215 tpm2_create -C parent.ctx -G rsa2048:rsaes -u key.pub -r key.priv
216
217 Create an ecc256 key with an ecdaa signing scheme with a count of 4 and
218 sha384 hash
219 /tpm2_create -C parent.ctx -G ecc256:ecdaa4-sha384 -u key.pub -r
220 key.priv cryptographic algorithms ALGORITHM.
221
223 This collection of options are common to many programs and provide in‐
224 formation that many users may expect.
225
226 • -h, --help=[man|no-man]: Display the tools manpage. By default, it
227 attempts to invoke the manpager for the tool, however, on failure
228 will output a short tool summary. This is the same behavior if the
229 “man” option argument is specified, however if explicit “man” is re‐
230 quested, the tool will provide errors from man on stderr. If the
231 “no-man” option if specified, or the manpager fails, the short op‐
232 tions will be output to stdout.
233
234 To successfully use the manpages feature requires the manpages to be
235 installed or on MANPATH, See man(1) for more details.
236
237 • -v, --version: Display version information for this tool, supported
238 tctis and exit.
239
240 • -V, --verbose: Increase the information that the tool prints to the
241 console during its execution. When using this option the file and
242 line number are printed.
243
244 • -Q, --quiet: Silence normal tool output to stdout.
245
246 • -Z, --enable-errata: Enable the application of errata fixups. Useful
247 if an errata fixup needs to be applied to commands sent to the TPM.
248 Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent. in‐
249 formation many users may expect.
250
252 The TCTI or “Transmission Interface” is the communication mechanism
253 with the TPM. TCTIs can be changed for communication with TPMs across
254 different mediums.
255
256 To control the TCTI, the tools respect:
257
258 1. The command line option -T or --tcti
259
260 2. The environment variable: TPM2TOOLS_TCTI.
261
262 Note: The command line option always overrides the environment vari‐
263 able.
264
265 The current known TCTIs are:
266
267 • tabrmd - The resource manager, called tabrmd
268 (https://github.com/tpm2-software/tpm2-abrmd). Note that tabrmd and
269 abrmd as a tcti name are synonymous.
270
271 • mssim - Typically used for communicating to the TPM software simula‐
272 tor.
273
274 • device - Used when talking directly to a TPM device file.
275
276 • none - Do not initalize a connection with the TPM. Some tools allow
277 for off-tpm options and thus support not using a TCTI. Tools that do
278 not support it will error when attempted to be used without a TCTI
279 connection. Does not support ANY options and MUST BE presented as
280 the exact text of “none”.
281
282 The arguments to either the command line option or the environment
283 variable are in the form:
284
285 <tcti-name>:<tcti-option-config>
286
287 Specifying an empty string for either the <tcti-name> or <tcti-op‐
288 tion-config> results in the default being used for that portion respec‐
289 tively.
290
291 TCTI Defaults
292 When a TCTI is not specified, the default TCTI is searched for using
293 dlopen(3) semantics. The tools will search for tabrmd, device and
294 mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query
295 what TCTI will be chosen as the default by using the -v option to print
296 the version information. The “default-tcti” key-value pair will indi‐
297 cate which of the aforementioned TCTIs is the default.
298
299 Custom TCTIs
300 Any TCTI that implements the dynamic TCTI interface can be loaded. The
301 tools internally use dlopen(3), and the raw tcti-name value is used for
302 the lookup. Thus, this could be a path to the shared library, or a li‐
303 brary name as understood by dlopen(3) semantics.
304
306 This collection of options are used to configure the various known TCTI
307 modules available:
308
309 • device: For the device TCTI, the TPM character device file for use by
310 the device TCTI can be specified. The default is /dev/tpm0.
311
312 Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“de‐
313 vice:/dev/tpm0”
314
315 • mssim: For the mssim TCTI, the domain name or IP address and port
316 number used by the simulator can be specified. The default are
317 127.0.0.1 and 2321.
318
319 Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TC‐
320 TI=“mssim:host=localhost,port=2321”
321
322 • abrmd: For the abrmd TCTI, the configuration string format is a se‐
323 ries of simple key value pairs separated by a `,' character. Each
324 key and value string are separated by a `=' character.
325
326 • TCTI abrmd supports two keys:
327
328 1. `bus_name' : The name of the tabrmd service on the bus (a
329 string).
330
331 2. `bus_type' : The type of the dbus instance (a string) limited to
332 `session' and `system'.
333
334 Specify the tabrmd tcti name and a config string of bus_name=com.ex‐
335 ample.FooBar:
336
337 \--tcti=tabrmd:bus_name=com.example.FooBar
338
339 Specify the default (abrmd) tcti and a config string of bus_type=ses‐
340 sion:
341
342 \--tcti:bus_type=session
343
344 NOTE: abrmd and tabrmd are synonymous. the various known TCTI mod‐
345 ules.
346
348 tpm2_createprimary -C o -c prim.ctx -Q
349
350 tpm2_create -C prim.ctx -c key.ctx -u key.pub -r key.priv -G ecc256:ecdh
351
352 tpm2_ecdhkeygen -u ecdh.pub -o ecdh.priv -c key.ctx
353
354 tpm2_ecdhzgen -u ecdh.pub -o ecdh.dat -c key.ctx
355
357 Tools can return any of the following codes:
358
359 • 0 - Success.
360
361 • 1 - General non-specific error.
362
363 • 2 - Options handling error.
364
365 • 3 - Authentication error.
366
367 • 4 - TCTI related error.
368
369 • 5 - Non supported scheme. Applicable to tpm2_testparams.
370
372 Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
373
375 See the Mailing List (https://lists.linuxfoundation.org/mailman/listin‐
376 fo/tpm2)
377
378
379
380tpm2-tools tpm2_ecdhzgen(1)