Ever hear of PKCS#11 URIs? RFC 7512 specifies the pkcs11: URI scheme. Sometimes I think it'd be nice to...
Ever hear of PKCS#11 URIs? RFC 7512 specifies the pkcs11: URI scheme. Sometimes I think it'd be nice to have the same for TPM 2.0.
A TPM 2.0 URI would have:
- an authority part to identify how to speak to the TPM (this might not be local!),
- an optional local part to identify a TPM command to execute,
- optional query parameters for the arguments to the command,
- optional query parameters with percent-encoded URIs for specifying key derivation templates and context / wrapped object save files that would be parameters to the command,
- optional objects and parameters to use for session encryption,
- optional q-params naming an authorization policy to execute parameters regarding the policy,
- what else?
Well, ok, that's pretty busy. Maybe a language specifying all of that and yielding a profile that can be executed by a utility function/method/program with appropriate parameters (taken from the specification). A URI could be used just to specify how to reach the TPM, and maybe how to establish an HMAC/encryption session with it. Then to use a TPM one would only have to write such a profile then execute it with whatever parameters. This would make it very easy to use TPMs!
π
3β€οΈ
π
π‘
π
π
Explore More Posts
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
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.
Earlier today we released tpm2-tss 4.2.2 and 4.1.6 with additional security fixes and compatibility improvements. https://github.com/tpm2-software/tpm2-tss/releases This is the third patch release for 4.1.x this year. I am happy we are picking up speed for faster security patches while sharing knowledge on the tpm2-tss release process among the maintainers.




Comments
Start the Conversation
For reference: https://www.rfc-editor.org/rfc/rfc7512
Now consider a tool like https://mprimi.github.io/portable-secret/ and then imagine if the web crypto APIs included a way to use a TPM. Well, ok, `portable-secret` relies on passwords, and using TPM would require public key management, which means that enrollment (and attestation) would have to be possible via those APIs. It'd be nice for all of that to be super simple.
We did something similar with our attestation engine by building a layer-7 (and layer-6) protocol. Works quite well but needs standardisation (and maybe publication too :-) )
Another thing is that one can think of the operations one really wishes to do, such as "decrypt with some shielded key", or "HMAC with some shielded key", or "extend PCR", or "get a quote", and then the complete set of TPM2 calls to make can be β¦more