{
  "id": 8159303,
  "title": "From Sending Raw TPM Commands to Parsing Responses with Windows TBS",
  "url": "https://urgent.news/2026/09/18/from-sending-raw-tpm-commands-to-parsing-responses-with-windows-tbs",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-18T03:02:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/tsuruko12/from-sending-raw-tpm-commands-to-parsing-responses-with-windows-tbs-3iig"
  },
  "original_language": "en",
  "account": "The article describes the process of interacting with TPM 2.0 by sending raw commands through Windows TBS (TPM Base Services), implemented in Rust. The example focuses on the TPM2_GetRandom command, which generates random bytes.\n\nFirst, a TBS context is created using Tbsi_Context_Create function. This context is necessary for further communication with the TPM. Then, the command to be sent is marshaled - essentially converting the command into a sequence of bytes in big-endian byte order. The command header comprises three elements: tag, commandSize, and commandCode, and is always 10 bytes long.\n\nThe function marshal_get_random_command takes the number of requested bytes as input and returns a vector of bytes representing the command. The header is created by setting the tag to TPM_ST_NO_SESSIONS, commandSize to the total size of the command, and commandCode to TPM2_GET_RANDOM.\n\nOnce the command is ready, it is submitted to the TPM using the submit function, which returns a response. The response is then parsed to extract the generated random bytes using the parse_response function. These bytes are printed to the console. Finally, the TBS context is closed using close_context function.",
  "summary": "I tried interacting with TPM 2.0 by sending raw commands through Windows TBS (TPM Base Services). The implementation is written in Rust . This article walks through the entire process, from creating a TBS context to sending a TPM command and parsing the response. Overall Flow The following is a simplified example of the complete TPM2_GetRandom flow: marshal the command → submit it → parse the…",
  "key_points": [
    "TBS context created for TPM communication",
    "GetRandom command marshaled into byte sequence",
    "Response parsed to extract random bytes"
  ],
  "editors_take": "This development shows that Rust can be used to effectively interact with TPM 2.0 through Windows TBS, enabling the generation and retrieval of random bytes in a straightforward and structured manner.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}