1tpm2_ecdhkeygen(1)          General Commands Manual         tpm2_ecdhkeygen(1)
2
3
4

NAME

6       tpm2_ecdhkeygen(1)  -  Creates an ephemeral key and uses it to generate
7       the shared secret value using the parameters from a ECC public key.
8

SYNOPSIS

10       tpm2_ecdhkeygen [OPTIONS]
11

DESCRIPTION

13       tpm2_ecdhkeygen(1) - Creates an ephemeral key and uses it  to  generate
14       the shared secret value using the parameters from a ECC public key.
15

OPTIONS

17-c, --context=FILE:
18
19         Context object pointing to ECC public key.  Either a file or a handle
20         number.  See section “Context Object Format”.
21
22-u, --public=FILE:
23
24         Output ECC point Q.
25
26-o, --output=FILE
27
28         Specify file path to save the calculated ecdh secret or Z point.
29
30--cphash=FILE
31
32         File path to record the hash of the command parameters.  This is com‐
33         monly termed as cpHash.  NOTE: When this option is selected, The tool
34         will not actually execute the command, it simply returns a cpHash.
35
36   References

Algorithm Specifiers

38       Options that take algorithms support “nice-names”.
39
40       There are two major algorithm specification string classes, simple  and
41       complex.  Only certain algorithms will be accepted by the TPM, based on
42       usage and conditions.
43
44   Simple specifiers
45       These are strings with no additional specification data.  When creating
46       objects,  non-specified  portions of an object are assumed to defaults.
47       You can find the list of known “Simple Specifiers” below.
48
49   Asymmetric
50       • rsa
51
52       • ecc
53
54   Symmetric
55       • aes
56
57       • camellia
58
59       • sm4
60
61   Hashing Algorithms
62       • sha1
63
64       • sha256
65
66       • sha384
67
68       • sha512
69
70       • sm3_256
71
72       • sha3_256
73
74       • sha3_384
75
76       • sha3_512
77
78   Keyed Hash
79       • hmac
80
81       • xor
82
83   Signing Schemes
84       • rsassa
85
86       • rsapss
87
88       • ecdsa
89
90       • ecdaa
91
92       • ecschnorr
93
94       • sm2
95
96   Asymmetric Encryption Schemes
97       • oaep
98
99       • rsaes
100
101       • ecdh
102
103   Modes
104       • ctr
105
106       • ofb
107
108       • cbc
109
110       • cfb
111
112       • ecb
113
114   Misc
115       • null
116
117   Complex Specifiers
118       Objects, when specified for creation by the TPM,  have  numerous  algo‐
119       rithms  to  populate  in the public data.  Things like type, scheme and
120       asymmetric details, key size, etc.  Below is  the  general  format  for
121       specifying this data: <type>:<scheme>:<symmetric-details>
122
123   Type Specifiers
124       This  portion  of the complex algorithm specifier is required.  The re‐
125       maining scheme and symmetric details will default  based  on  the  type
126       specified and the type of the object being created.
127
128       • aes - Default AES: aes128
129
130       • aes128<mode>  - 128 bit AES with optional mode (ctr|ofb|cbc|cfb|ecb).
131         If mode is not specified, defaults to null.
132
133       • aes192<mode> - Same as aes128<mode>, except for a 192 bit key size.
134
135       • aes256<mode> - Same as aes128<mode>, except for a 256 bit key size.
136
137       • sm4 - Default SM4: sm4128
138
139       • sm4128  or  sm4_128  <mode>  -  128  bit  SM4  with   optional   mode
140         (ctr|ofb|cbc|cfb|ecb).  If mode is not specified, defaults to null.
141
142       • ecc - Elliptical Curve, defaults to ecc256.
143
144       • ecc192 or ecc_nist_p192 - 192 bit ECC NIST curve
145
146       • ecc224 or ecc_nist_p224 - 224 bit ECC NIST curve
147
148       • ecc256 or ecc_nist_p256 - 256 bit ECC NIST curve
149
150       • ecc384 or ecc_nist_p384 - 384 bit ECC NIST curve
151
152       • ecc521 or ecc_nist_p521 - 521 bit ECC NIST curve
153
154       • ecc_sm2 or ecc_sm2_p256 - 256 bit SM2 curve
155
156       • rsa - Default RSA: rsa2048
157
158       • rsa1024 - RSA with 1024 bit keysize.
159
160       • rsa2048 - RSA with 2048 bit keysize.
161
162       • rsa3072 - RSA with 3072 bit keysize.
163
164       • rsa4096 - RSA with 4096 bit keysize.
165
166   Scheme Specifiers
167       Next, is an optional field, it can be skipped.
168
169       Schemes  are  usually Signing Schemes or Asymmetric Encryption Schemes.
170       Most signing schemes take a hash algorithm directly following the sign‐
171       ing  scheme.   If the hash algorithm is missing, it defaults to sha256.
172       Some take no arguments, and some take multiple arguments.
173
174   Hash Optional Scheme Specifiers
175       These scheme specifiers are followed by a dash and a valid  hash  algo‐
176       rithm, For example: oaep-sha256.
177
178       • oaep
179
180       • ecdh
181
182       • rsassa
183
184       • rsapss
185
186       • ecdsa
187
188       • ecschnorr
189
190       • sm2
191
192   Multiple Option Scheme Specifiers
193       This  scheme  specifier  is  followed by a count (max size UINT16) then
194       followed by a dash(-) and a valid hash algorithm.  * ecdaa For example,
195       ecdaa4-sha256.  If no count is specified, it defaults to 4.
196
197   No Option Scheme Specifiers
198       This scheme specifier takes NO arguments.  * rsaes
199
200   Symmetric Details Specifiers
201       This  field is optional, and defaults based on the type of object being
202       created and it’s attributes.  Generally, any valid Symmetric  specifier
203       from  the Type Specifiers list should work.  If not specified, an asym‐
204       metric objects symmetric details defaults to aes128cfb.
205
206   Examples
207   Create an rsa2048 key with an rsaes asymmetric encryption scheme
208       tpm2_create -C parent.ctx -G rsa2048:rsaes -u key.pub -r key.priv
209
210   Create an ecc256 key with an ecdaa signing scheme with a  count  of  4  and
211       sha384 hash
212       /tpm2_create  -C  parent.ctx  -G  ecc256:ecdaa4-sha384  -u  key.pub  -r
213       key.priv cryptographic algorithms ALGORITHM.
214

COMMON OPTIONS

216       This collection of options are common to many programs and provide  in‐
217       formation that many users may expect.
218
219-h,  --help=[man|no-man]:  Display the tools manpage.  By default, it
220         attempts to invoke the manpager for the  tool,  however,  on  failure
221         will  output  a short tool summary.  This is the same behavior if the
222         “man” option argument is specified, however if explicit “man” is  re‐
223         quested,  the  tool  will  provide errors from man on stderr.  If the
224         “no-man” option if specified, or the manpager fails,  the  short  op‐
225         tions will be output to stdout.
226
227         To  successfully use the manpages feature requires the manpages to be
228         installed or on MANPATH, See man(1) for more details.
229
230-v, --version: Display version information for this  tool,  supported
231         tctis and exit.
232
233-V,  --verbose:  Increase the information that the tool prints to the
234         console during its execution.  When using this option  the  file  and
235         line number are printed.
236
237-Q, --quiet: Silence normal tool output to stdout.
238
239-Z, --enable-errata: Enable the application of errata fixups.  Useful
240         if an errata fixup needs to be applied to commands sent to  the  TPM.
241         Defining  the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.  in‐
242         formation many users may expect.
243

TCTI Configuration

245       The TCTI or “Transmission Interface”  is  the  communication  mechanism
246       with  the TPM.  TCTIs can be changed for communication with TPMs across
247       different mediums.
248
249       To control the TCTI, the tools respect:
250
251       1. The command line option -T or --tcti
252
253       2. The environment variable: TPM2TOOLS_TCTI.
254
255       Note: The command line option always overrides  the  environment  vari‐
256       able.
257
258       The current known TCTIs are:
259
260       • tabrmd      -     The     resource     manager,     called     tabrmd
261         (https://github.com/tpm2-software/tpm2-abrmd).  Note that tabrmd  and
262         abrmd as a tcti name are synonymous.
263
264       • mssim  - Typically used for communicating to the TPM software simula‐
265         tor.
266
267       • device - Used when talking directly to a TPM device file.
268
269       • none - Do not initalize a connection with the TPM.  Some tools  allow
270         for off-tpm options and thus support not using a TCTI.  Tools that do
271         not support it will error when attempted to be used  without  a  TCTI
272         connection.   Does  not  support ANY options and MUST BE presented as
273         the exact text of “none”.
274
275       The arguments to either the command  line  option  or  the  environment
276       variable are in the form:
277
278       <tcti-name>:<tcti-option-config>
279
280       Specifying  an  empty  string  for  either the <tcti-name> or <tcti-op‐
281       tion-config> results in the default being used for that portion respec‐
282       tively.
283
284   TCTI Defaults
285       When  a  TCTI  is not specified, the default TCTI is searched for using
286       dlopen(3) semantics.  The tools will  search  for  tabrmd,  device  and
287       mssim  TCTIs  IN THAT ORDER and USE THE FIRST ONE FOUND.  You can query
288       what TCTI will be chosen as the default by using the -v option to print
289       the  version information.  The “default-tcti” key-value pair will indi‐
290       cate which of the aforementioned TCTIs is the default.
291
292   Custom TCTIs
293       Any TCTI that implements the dynamic TCTI interface can be loaded.  The
294       tools internally use dlopen(3), and the raw tcti-name value is used for
295       the lookup.  Thus, this could be a path to the shared library, or a li‐
296       brary name as understood by dlopen(3) semantics.
297

TCTI OPTIONS

299       This collection of options are used to configure the various known TCTI
300       modules available:
301
302device: For the device TCTI, the TPM character device file for use by
303         the device TCTI can be specified.  The default is /dev/tpm0.
304
305         Example:    -T   device:/dev/tpm0   or   export   TPM2TOOLS_TCTI=“de‐
306         vice:/dev/tpm0”
307
308mssim: For the mssim TCTI, the domain name or  IP  address  and  port
309         number  used  by  the  simulator  can  be specified.  The default are
310         127.0.0.1 and 2321.
311
312         Example: -T mssim:host=localhost,port=2321  or  export  TPM2TOOLS_TC‐
313         TI=“mssim:host=localhost,port=2321”
314
315abrmd:  For  the abrmd TCTI, the configuration string format is a se‐
316         ries of simple key value pairs separated by a  `,'  character.   Each
317         key and value string are separated by a `=' character.
318
319         • TCTI abrmd supports two keys:
320
321           1. `bus_name'  :  The  name  of  the  tabrmd  service on the bus (a
322              string).
323
324           2. `bus_type' : The type of the dbus instance (a string) limited to
325              `session' and `system'.
326
327         Specify  the tabrmd tcti name and a config string of bus_name=com.ex‐
328         ample.FooBar:
329
330                \--tcti=tabrmd:bus_name=com.example.FooBar
331
332         Specify the default (abrmd) tcti and a config string of bus_type=ses‐
333         sion:
334
335                \--tcti:bus_type=session
336
337         NOTE:  abrmd  and tabrmd are synonymous.  the various known TCTI mod‐
338         ules.
339

EXAMPLES

341              tpm2_createprimary -C o -c prim.ctx -Q
342
343              tpm2_create -C prim.ctx -c key.ctx -u key.pub -r key.priv -G ecc256:ecdaa
344
345              tpm2_ecdhkeygen -u ecdh.pub -o ecdh.priv -c key.ctx
346

Returns

348       Tools can return any of the following codes:
349
350       • 0 - Success.
351
352       • 1 - General non-specific error.
353
354       • 2 - Options handling error.
355
356       • 3 - Authentication error.
357
358       • 4 - TCTI related error.
359
360       • 5 - Non supported scheme.  Applicable to tpm2_testparams.
361

BUGS

363       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
364

HELP

366       See the Mailing List (https://lists.linuxfoundation.org/mailman/listin
367       fo/tpm2)
368
369
370
371tpm2-tools                                                  tpm2_ecdhkeygen(1)
Impressum