Prove your correct software status to anyone simply by signing with your sealed key
As you know, the TPM standard is very complex with lots of functionalities and very cool combinations. So, I realized that by combining different policies I could create a unique private key that could be used just with the device to be attested (Attestor) is in a trusted status, and using the same key even when receiving updates.
As you know, in a remote attestation process we have a Verifier and an Attestor and the value of the PCR in the middle. When the process was finalized, the Verifier verified the software status of the attestor, but every time it wants to check it, it have to pass through a complete remote attestation process again.
So, I asked, why don't create a private key sealed to the value of reset of TPM? Because the device can go to an unsafe status even without the need of resetting... Then... why not create a private key sealed to the value of the PCR? Because the value of the PCR is very dynamic, by changing the order in which the program starts, the value of PCR will be different and even if Attestor is in a reliable state it would need a new private key. Then... Why don't creating a private key sealed to a dynamic condition?

Solution
In a nutshell, when Attestor passes successfully through a remote attestation process, the verifier sends an authorization to Attesstor for using the Sealed key as long as the values of resets and value of PCR remain the same. So the verifier recreates the commands:
tpm2_policypcr
tpm2_policycountertimer
And then, it signs the result and sends it to Attestor, that can unseal his private key using :
tpm2_policyauthorize
But one of the questions is, how can we trust that the Sealed key is a key sealed with tpm2_policyauthorize to the public key of the verifier?
Well, to solve that problem we use the same Attestation key used to sign the PCR values in the quote to sign a certificate of the Sealed key with:
tpm2_certify
The verifier will check first that the very important Sealed key was correctly created and that it can be used if and only if Attestor receives a signed authorization from the verifier. (Attributes of keys are also considered in the verification of all the keys).
Conclusion
All this cool functionality is completely remote, and the Verifier can "remotely create" the sealed key even in an untrusted Attestor, and when Attesor passes the verification, it receives authorization to use the remotely created Sealed key and a certificate for this key from the verifier. Then, Attestor can probe ownership of the Sealed key to any third entity, and this entity just by verifying a signature would know that the Attestor passes through a remote attention process of Verifier and that the PCR value (and hence the software) is still the same. All the process is fully explained in https://www.mdpi.com/1424-8220/22/13/5060.
And all the process is in a public repository that is kind of friendly, with everything prepared to reproduce the process are your place!. (you can find the link to the repository in the paper, in section "4.6. Implementation" and then I will get some views... hehe).
In the section Acknowledgments in the paper, you will find a reference to TPM.dev, which was essential for me to learn all the fancy stuff to create this.
I am looking forward to your comments and feedback!
EDIT: I forgot to say, I called the process: RESEKRA: Remote Enrollment Using SEaled Keys for Remote Attestation
#Applications👍
3❤️
👍
💡
👏
😂
Explore More Posts
Sneak-peak at our #TPMDEV2026 Conference. One slide from each main talk. Expect the recordings soon as we are migrating to Youtube. The news from today is that we are resuming our monthly calls and we will have in-person #TPMDEV2027! Check TPM.dev for more info.
Random Number Generator (TPM2)
1. IntroductionAmong other features, Trusted Platform Modules (TPM) comes with a True Random Number Generator (TRNG) that can be used for various applications including cryptographic purposes. This RNG module serves as the source for randomness for the TPM 2.0 Chip. A RNG module in TPM2 will typically contain the following -
An entropy source and collector
State Register
A mixing func.
There can be two types of calls to the TPM’s Random Number Generator, Internal call and External Call. RNG is capable to provide enough randomness for all the internal calls made. As well as, RNG is capable of providing 32 octets of randomness as per the specification to an external call. Another thing to note here is, each call made to the RNG produces a new value irrespective of the type of call. 1.1 The source of RandomnessThe source of entropy in the TPM is the entropy collector. As the name suggests, entropy collector collects entropy from entropy sources and also removes bias. A TPM2.0 has at least one internal source of entropy. These sources can include noise, clock variations, air movement amongst other events. As depicted in Fig 1.1 the entropy collector provides input to the State Register. 1.2 Stages involved Various algorithms and process supported by TPM calls RNG for unpredictable numbers, which is actually obtained from “RNG Protected Capability”. The “Deterministic Random Bit Generator (DRBG) Protected Capability“ obtains entropy from “Entropy Protected Capability”. Along with Entropy Protected Capability, TPM2_StirRandom() can also gather entropy from other entropy sources within the same TPM. 2. Random Numbers via TPM2 ToolsIf one needs to use TPM’s RNG for other external applications, then TPM2 Tools Command Line tools can be a great option. TPM2 Tools Command : tpm2_getrandom - - hex 16 - - hex : Converts output to hexadecimal 16 : Size in bytes Now, if one wants to have additional randomness, TPM2 Tools provides a convenient utility for this purpose called tpm2_stirrandom. To inject entropy via TPM2_StirRandom() to “Entropy Protected Capability” , we can use some file or use stdin. TPM2 Tools Command : echo -n “some_random_data” | tpm2_stirrandom Note : 128 bytes can only be injected using stdin at once through stirrandom() 3. ConclusionThe TPM2 provides in a sense True Random Numbers for use. These unpredictable numbers are coming from a dedicated hardware, hence can be trusted to be given as input to Crypto Algorithms amongst other applications. TPM2 also uses this for its internal use, and TCG claims it to be as secure as the strongest algorithm that TPM supports. Also, using the RNG is pretty straight forward via TPM2 Tools. #Tutorials
The latest tpm2-tools 5.8 release addresses three GitHub security advisories. One is a heap overflow in tpm2_getekcertificate, and the other is an out-of-bounds write that happens when too many sessions are in use. I don’t have information on the third advisory. Beyond the fixes, 5.8 extends EK certificate handling. It adds the option to read EK certificates from NV RAM, introduces new EK templates and supports a marshaled quote format. https://github.com/tpm2-software/tpm2-tools/releases/tag/5.8



Comments
Start the Conversation
Also there should be no way to load the SeK after a tpm2_clear, but that should be already enforced by how the SeK is created.
Well... tpm2_clear should be limited to the platform hierarchy, but never mind, if an attacker can execute any tpm command or modify something to make it be measured by the IMA, a deny of service attack (DoS) in the use of the sealed key is the least …more
You are right, a real end product would require a very detailed definition of IMA.
"Did you collect some statistics on how much calls to the verifier are needed during …more
Ernesto Gomez Marin I think the title of the article needs to be modified. Because ever since TPM is around verifying the AK pub is sufficient to have remote attestation. However, you are not talking about a managed list of public TPM keys and …more
Ernesto Gomez Marin sure, I will DM you :)