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

NAME

6       tpm2_readpublic(1) - Read the public area of a loaded object.
7

SYNOPSIS

9       tpm2_readpublic [OPTIONS]
10

DESCRIPTION

12       tpm2_readpublic(1) - Reads the public area of a loaded object.
13

OPTIONS

15       · -c, --object-context=OBJECT:
16
17         Context object for the object to read.
18
19       · -n, --name=FILE:
20
21         An optional file to save the name structure of the object.
22
23       · -f, --format=FORMAT:
24
25         Public key format.
26
27       · -o, --output=FILE:
28
29         The output file path, recording the public portion of the object.
30
31       · -t, --serialized-handle=HANDLE:
32
33         If  the  object  to be read is a persistent object specified by a raw
34         handle, optionally save the serialized handle for  use  later.   This
35         routine  does  NOT verify the name of the object being read.  Callers
36         should ensure that the contents of name match  the  expected  objects
37         name.
38
39   References

Context Object Format

41       The  type  of a context object, whether it is a handle or file name, is
42       determined according to the following logic in-order:
43
44       · If the argument is a file path, then the file is loaded as a restored
45         TPM transient object.
46
47       · If the argument is a prefix match on one of:
48
49         · owner: the owner hierarchy
50
51         · platform: the platform hierarchy
52
53         · endorsement: the endorsement hierarchy
54
55         · lockout: the lockout control persistent object
56
57       · If  the  argument argument can be loaded as a number it will be treat
58         as a handle, e.g.  0x81010013 and used directly.OBJECT.
59

COMMON OPTIONS

61       This collection of options are common to many programs and provide  in‐
62       formation that many users may expect.
63
64       · -h,  --help=[man|no-man]:  Display the tools manpage.  By default, it
65         attempts to invoke the manpager for the  tool,  however,  on  failure
66         will  output  a short tool summary.  This is the same behavior if the
67         "man" option argument is specified, however if explicit "man" is  re‐
68         quested,  the  tool  will  provide errors from man on stderr.  If the
69         "no-man" option if specified, or the manpager fails,  the  short  op‐
70         tions will be output to stdout.
71
72         To  successfully use the manpages feature requires the manpages to be
73         installed or on MANPATH, See man(1) for more details.
74
75       · -v, --version: Display version information for this  tool,  supported
76         tctis and exit.
77
78       · -V,  --verbose:  Increase the information that the tool prints to the
79         console during its execution.  When using this option  the  file  and
80         line number are printed.
81
82       · -Q, --quiet: Silence normal tool output to stdout.
83
84       · -Z, --enable-errata: Enable the application of errata fixups.  Useful
85         if an errata fixup needs to be applied to commands sent to  the  TPM.
86         Defining  the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.  in‐
87         formation many users may expect.
88

TCTI Configuration

90       The TCTI or "Transmission Interface"  is  the  communication  mechanism
91       with  the TPM.  TCTIs can be changed for communication with TPMs across
92       different mediums.
93
94       To control the TCTI, the tools respect:
95
96       1. The command line option -T or --tcti
97
98       2. The environment variable: TPM2TOOLS_TCTI.
99
100       Note: The command line option always overrides  the  environment  vari‐
101       able.
102
103       The current known TCTIs are:
104
105       · tabrmd      -     The     resource     manager,     called     tabrmd
106         (https://github.com/tpm2-software/tpm2-abrmd).  Note that tabrmd  and
107         abrmd as a tcti name are synonymous.
108
109       · mssim  - Typically used for communicating to the TPM software simula‐
110         tor.
111
112       · device - Used when talking directly to a TPM device file.
113
114       · none - Do not initalize a connection with the TPM.  Some tools  allow
115         for off-tpm options and thus support not using a TCTI.  Tools that do
116         not support it will error when attempted to be used  without  a  TCTI
117         connection.   Does  not  support ANY options and MUST BE presented as
118         the exact text of "none".
119
120       The arguments to either the command  line  option  or  the  environment
121       variable are in the form:
122
123       <tcti-name>:<tcti-option-config>
124
125       Specifying  an  empty  string  for  either the <tcti-name> or <tcti-op‐
126       tion-config> results in the default being used for that portion respec‐
127       tively.
128
129   TCTI Defaults
130       When  a  TCTI  is not specified, the default TCTI is searched for using
131       dlopen(3) semantics.  The tools will  search  for  tabrmd,  device  and
132       mssim  TCTIs  IN THAT ORDER and USE THE FIRST ONE FOUND.  You can query
133       what TCTI will be chosen as the default by using the -v option to print
134       the  version information.  The "default-tcti" key-value pair will indi‐
135       cate which of the aforementioned TCTIs is the default.
136
137   Custom TCTIs
138       Any TCTI that implements the dynamic TCTI interface can be loaded.  The
139       tools internally use dlopen(3), and the raw tcti-name value is used for
140       the lookup.  Thus, this could be a path to the shared library, or a li‐
141       brary name as understood by dlopen(3) semantics.
142

TCTI OPTIONS

144       This collection of options are used to configure the various known TCTI
145       modules available:
146
147       · device: For the device TCTI, the TPM character device file for use by
148         the device TCTI can be specified.  The default is /dev/tpm0.
149
150         Example:    -T   device:/dev/tpm0   or   export   TPM2TOOLS_TCTI="de‐
151         vice:/dev/tpm0"
152
153       · mssim: For the mssim TCTI, the domain name or  IP  address  and  port
154         number  used  by  the  simulator  can  be specified.  The default are
155         127.0.0.1 and 2321.
156
157         Example: -T mssim:host=localhost,port=2321  or  export  TPM2TOOLS_TC‐
158         TI="mssim:host=localhost,port=2321"
159
160       · abrmd:  For  the abrmd TCTI, the configuration string format is a se‐
161         ries of simple key value pairs separated by a  ','  character.   Each
162         key and value string are separated by a '=' character.
163
164         · TCTI abrmd supports two keys:
165
166           1. 'bus_name'  :  The  name  of  the  tabrmd  service on the bus (a
167              string).
168
169           2. 'bus_type' : The type of the dbus instance (a string) limited to
170              'session' and 'system'.
171
172         Specify  the tabrmd tcti name and a config string of bus_name=com.ex‐
173         ample.FooBar:
174
175         \--tcti=tabrmd:bus_name=com.example.FooBar
176
177         Specify the default (abrmd) tcti and a config string of bus_type=ses‐
178         sion:
179
180         \--tcti:bus_type=session
181
182         NOTE:  abrmd  and tabrmd are synonymous.  the various known TCTI mod‐
183         ules.  # EXAMPLES
184
185   Create a primary object and read the public structure in an openssl
186       compliant format
187
188              tpm2_createprimary -c primary.ctx
189              tpm2_readpublic -c primary.ctx -o output.dat -f pem
190
191   Serialize an existing persistent object handle to disk for later use
192       This work-flow is primarily intended for existing  persistent  TPM  ob‐
193       jects.   This work-flow does not verify that the name of the serialized
194       object matches the expected, and thus the serialized  handle  could  be
195       pointing  to  an attacker controlled object if no verification is done.
196       If you are creating an object from scratch, save the serialized  handle
197       when making the object persistent.
198
199       We assume that an object has already been persisted, for example via:
200
201              # We assume that an object has already been persisted, for example
202              tpm2_createprimary -c primary.ctx
203
204              # context files have all the information for the TPM to verify the object
205              tpm2_evictcontrol -c primary.ctx
206              persistent-handle: 0x81000001
207              action: persisted
208
209       Next use the persistent handle to get a serialized handle:
210
211              # The persistent handle output could be at an attacker controlled object,
212              # best practice is to use the option "-o: for tpm2_evictcontrol to get a
213              # serialized handle instead.
214
215              tpm2_readpublic -c 0x81000001 -o output.dat -f pem -t primary.handle
216
217              # use this verified handle in an encrypted session with the tpm
218              tpm2_startauthsession --policy-session -S session.ctx -c primary.handle
219
220       For new objects, its best to use all serialized handles.
221

Returns

223       Tools can return any of the following codes:
224
225       · 0 - Success.
226
227       · 1 - General non-specific error.
228
229       · 2 - Options handling error.
230
231       · 3 - Authentication error.
232
233       · 4 - TCTI related error.
234
235       · 5 - Non supported scheme.  Applicable to tpm2_testparams.
236

BUGS

238       Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
239

HELP

241       See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)
242
243
244
245tpm2-tools                                                  tpm2_readpublic(1)
Impressum