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