tpm2tss-genkey(1) | General Commands Manual | tpm2tss-genkey(1) |
tpm2tss-genkey(1) – generate TPM keys for tpm2-tss-engine
tpm2tss-genkey [options] <filename>
tpm2tss-genkey creates a key inside a TPM 2.0 connected via the tpm2tss software stack. Those keys may be an RSA key for decryption or signing or an ECC key for ECDSA signatures.
The tool respects the OPENSSL_CONF option for specifying engine specific control parameters. See man(5) config for details on openssl config files.
The tpm2tss-genkey command expects a filename for storing the resulting TPM key information. This file can then be loaded with OpenSSL using openssl pkeyutl -engine tpm2tss -keyform engine -inkey <filename>.
Engine information can be retrieved using:
$ openssl engine -t -c tpm2tss
The following sequence of commands creates an RSA key using the TPM, exports the public key, encrypts a data file and decrypts it using the TPM:
$ tpm2tss-genkey -a rsa -s 2048 mykey $ openssl rsa -engine tpm2tss -inform engine -in mykey -pubout -outform pem -out mykey.pub $ openssl pkeyutl -pubin -inkey mykey.pub -in mydata -encrypt -out mycipher $ openssl pkeyutl -engine tpm2tss -keyform engine -inkey mykey -decrypt -in mycipher -out mydata
The following sequence of commands creates an RSA key using the TPM, exports the public key, signs a data file using the TPM and validates the signature:
$ tpm2tss-genkey -a rsa -s 2048 mykey $ openssl rsa -engine tpm2tss -inform engine -in mykey -pubout -outform pem -out mykey.pub $ openssl pkeyutl -engine tpm2tss -keyform engine -inkey mykey -sign -in mydata -out mysig $ openssl pkeyutl -engine tpm2tss -keyform engine -inkey mykey -verify -in mydata -sigfile mysig
The following sequence of commands creates an ECDSA key using the TPM, exports the public key, signs a data file using the TPM and validates the signature:
$ tpm2tss-genkey -a ecdsa -c nist_p256 mykey $ openssl pkeyutl -engine tpm2tss -keyform engine -inkey mykey -sign -in mydata -out mysig $ openssl pkeyutl -engine tpm2tss -keyform engine -inkey mykey -verify -in mydata -sigfile mysig
0 on success or 1 on failure.
Written by Andreas Fuchs.
tpm2tss is Copyright (C) 2017-2018 Fraunhofer SIT sponsored by Infineon Technologies AG. License BSD 3-clause.
openssl(1)
OCTOBER 2020 | tpm2-tss-engine |