Skip to content

Support for tpm persistent handles in TSS2 privkey#165

Open
royalsreafer wants to merge 1 commit into
tpm2-software:masterfrom
royalsreafer:master
Open

Support for tpm persistent handles in TSS2 privkey#165
royalsreafer wants to merge 1 commit into
tpm2-software:masterfrom
royalsreafer:master

Conversation

@royalsreafer

Copy link
Copy Markdown

This commit adds support for encoding and decoding of TSS2 pem files which contain references to persistent handles. The handle is stored in the same privkey area as the keyblob. The length(4 bytes) and the first byte(0x81 for persistent handles) distinguishes it as a persistent key stored in the TPM. This approach keeps true to the ASN1 structure defined in OID "2.23.133.10.1.3" .

I've used this patch for a while now and has been working out for our use-case. The use-case being adding support for TPM2 keys without changing the code of applications. Many applications supporting OpenSSL, do not support loading TPM keys with the handle:81xxxxxx due to the ossl_store_ex not being called. TSS2 pem keys circumvent this and adding persistent key handle support to this format solved the issue with TPM2 persistent key support.

Another pull request with a different approach #162

@royalsreafer royalsreafer force-pushed the master branch 7 times, most recently from a82ff3e to d68463f Compare March 7, 2026 17:24
@royalsreafer royalsreafer reopened this Mar 7, 2026
@royalsreafer royalsreafer changed the title Added support for tpm persistent handles in TSS2 privkey Support for tpm persistent handles in TSS2 privkey Mar 8, 2026
Signed-off-by: RoyalReafer <royalsmods@hotmail.com>
@shmset

shmset commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

@royalsreafer I've just seen your approach to use persistent handles. Integrates much nicer into the existing ASN1 structure.

@LordGaav

LordGaav commented Jun 2, 2026

Copy link
Copy Markdown

Is there anything we can do to move this PR along? We're currently using a forked version of tpm2-openssl with this patch, which isn't a big deal on its own, but having it in the upstream release is even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants