tpm2_readpublic(1) | General Commands Manual | tpm2_readpublic(1) |
tpm2_readpublic(1) - Read the public area of a loaded object.
tpm2_readpublic [OPTIONS]
tpm2_readpublic(1) - Reads the public area of a loaded object.
Context object for the object to read.
An optional file to save the name structure of the object.
Format selection for the public key output file. `tss' (the default) will output a binary blob according to the TPM 2.0 Specification. `pem' will output an OpenSSL compatible PEM encoded public key. `der' will output an OpenSSL compatible DER encoded public key. `tpmt' will output a binary blob of the TPMT_PUBLIC struct referenced by TPM 2.0 specs.
Public key format.
The output file path, recording the public portion of the object.
If the object to be read is a persistent object specified by a raw handle, optionally save the serialized handle for use later. This routine does NOT verify the name of the object being read. Callers should ensure that the contents of name match the expected objects name.
Saves the qualified name of the object to FILE. The qualified name of the object is the name algorithm hash of the parents qualified and the objects name. Thus the qualified name of the object serves as proof of the objects parents.
The type of a context object, whether it is a handle or file name, is determined according to the following logic in-order:
This collection of options are common to many programs and provide information that many users may expect.
To successfully use the manpages feature requires the manpages to be installed or on MANPATH, See man(1) for more details.
The TCTI or “Transmission Interface” is the communication mechanism with the TPM. TCTIs can be changed for communication with TPMs across different mediums.
To control the TCTI, the tools respect:
Note: The command line option always overrides the environment variable.
The current known TCTIs are:
The arguments to either the command line option or the environment variable are in the form:
<tcti-name>:<tcti-option-config>
Specifying an empty string for either the <tcti-name> or <tcti-option-config> results in the default being used for that portion respectively.
When a TCTI is not specified, the default TCTI is searched for using dlopen(3) semantics. The tools will search for tabrmd, device and mssim TCTIs IN THAT ORDER and USE THE FIRST ONE FOUND. You can query what TCTI will be chosen as the default by using the -v option to print the version information. The “default-tcti” key-value pair will indicate which of the aforementioned TCTIs is the default.
Any TCTI that implements the dynamic TCTI interface can be loaded. The tools internally use dlopen(3), and the raw tcti-name value is used for the lookup. Thus, this could be a path to the shared library, or a library name as understood by dlopen(3) semantics.
This collection of options are used to configure the various known TCTI modules available:
Example: -T device:/dev/tpm0 or export TPM2TOOLS_TCTI=“device:/dev/tpm0”
Example: -T mssim:host=localhost,port=2321 or export TPM2TOOLS_TCTI=“mssim:host=localhost,port=2321”
Specify the tabrmd tcti name and a config string of bus_name=com.example.FooBar:
\--tcti=tabrmd:bus_name=com.example.FooBar
Specify the default (abrmd) tcti and a config string of bus_type=session:
\--tcti:bus_type=session
NOTE: abrmd and tabrmd are synonymous. the various known TCTI modules. # EXAMPLES
tpm2_createprimary -c primary.ctx tpm2_readpublic -c primary.ctx -o output.dat -f pem
This work-flow is primarily intended for existing persistent TPM objects. This work-flow does not verify that the name of the serialized object matches the expected, and thus the serialized handle could be pointing to an attacker controlled object if no verification is done. If you are creating an object from scratch, save the serialized handle when making the object persistent.
We assume that an object has already been persisted, for example via:
# We assume that an object has already been persisted, for example tpm2_createprimary -c primary.ctx # context files have all the information for the TPM to verify the object tpm2_evictcontrol -c primary.ctx persistent-handle: 0x81000001 action: persisted
Next use the persistent handle to get a serialized handle:
# The persistent handle output could be at an attacker controlled object, # best practice is to use the option "-o: for tpm2_evictcontrol to get a # serialized handle instead. tpm2_readpublic -c 0x81000001 -o output.dat -f pem -t primary.handle # use this verified handle in an encrypted session with the tpm tpm2_startauthsession --policy-session -S session.ctx -c primary.handle
For new objects, its best to use all serialized handles.
Tools can return any of the following codes:
Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
See the Mailing List (https://lists.linuxfoundation.org/mailman/listinfo/tpm2)
tpm2-tools |