tpm2tss-genkey(1)
π tpm2tss-genkey β like, the manual page bestie
Ok so this is tpm2tss-genkey(1) from the General Commands Manual β yes it's a section-1 page, yes we're fancy. Buckle up, we're making TPM keys π
β¨ NAME β¨
tpm2tss-genkey β the icon, the moment, the key generator for tpm2-tss-engine π«
πΈ SYNOPSIS πΈ
tpm2tss-genkey [options] <filename>
π¦ DESCRIPTION π¦
So tpm2tss-genkey literally creates a key inside a TPM 2.0, and that TPM gets connected through the tpm2tss software stack. No cap. π₯
And the keys it makes? They can be:
- an RSA key, for decryption or signing
- an ECC key, for ECDSA signatures
The tool respects the OPENSSL_CONF option so you can pass engine specific control parameters. If you wanna know the details on openssl config files, go look at man(5) config. iykyk β¨
π§ ARGUMENTS π§
tpm2tss-genkey expects a <filename> β that's where the resulting TPM key information gets stored, bestie. Then you can load that file with OpenSSL like this:
openssl pkeyutl -engine tpm2tss -keyform engine -inkey <filename>
Periodt. π
π OPTIONS π
-a<algorithm>,--alg<algorithm> β the public key algorithm, eitherrsaorecdsa(default:rsa)-c<curve>,--curve<curve> β if you pickedecdsafor alg, this is the curve for the ecc (default:nist_p256)-u<file>,--public<file> β the public key (TPM2B_PUBLIC) to be imported. Heads up: this one requires-rπ«Ά-r<file>,--private<file> β the (encrypted) private key (TPM2B_PRIVATE) to be imported. And this one requires-u-e<exponent>,--exponent<exponent> β if you pickedrsafor alg, this is the exponent for rsa (default:65537)-h,--helpβ print help, slay-o<password>,--ownerpw<password> β password for the owner hierarchy (default: none). Openssl Config control command:SET_OWNERAUTH-p<password>,--password<password> β password for the created key (default: none)-P<handle>,--parent<handle> β a specific handle for the parent key (default: none)-s<keysize>,--keysize<keysize> β if you pickedrsafor alg, the key size in bits (default:2048)-v,--verboseβ print verbose messages, so you can see what's happening π-W<password>,--parentpw<password> β password for the parent key (default: none). Openssl Config control command:SET_PARENTAUTH-t<tcti-conf>,--tcti<tcti-conf> β TCTI Configuration string (default: none). Openssl Config control command:SET_TCTI
π EXAMPLES π
Wanna grab engine info? Do this:
$ openssl engine -t -c tpm2tss
π RSA: make a key, export the pub, encrypt, then decrypt
This little sequence 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
β RSA: make a key, export the pub, sign, then verify
This one 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
π ECDSA: make a key, export the pub, sign, then verify
And this one 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
π«Ά RETURNS π«Ά
0 on success or 1 on failure. That's it, that's the vibe check.
π AUTHOR π
Written by Andreas Fuchs. (ty for your service bestie π)
π COPYRIGHT π
tpm2tss is Copyright (C) 2017-2018 Fraunhofer SIT sponsored by Infineon Technologies AG. License BSD 3-clause.
π SEE ALSO π
openssl(1) β go read it, it's giving main character energy
ok that's the whole page, nothing skipped, no crumbs left behind π
This masterpiece is from tpm2-tss-engine, dated OCTOBER 2020 β mwah, stan forever πβ¨
π¦ where this page comes from
- alpine 3.24: tpm2-tss-engine-doc 1.2.0-r3 Β· BSD-2-Clause
- fedora 43: tpm2-tss-engine-utilities 1.2.0-8.fc43 Β· BSD-3-Clause
- fedora 44: tpm2-tss-engine-utilities 1.2.0-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: tpm2-tss-engine 1.2.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: tpm2-tss-engine 1.2.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: tpm2-tss-engine 1.2.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: tpm2-tss-engine 1.2.0-160000.2.2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms