google/go-tspi

GitHub: google/go-tspi

为 Go 开发者提供与 TPM 硬件通信的 libtspi 绑定,包含底层接口、证明验证辅助函数以及客户端-守护进程架构。

Stars: 64 | Forks: 21

# go-tspi - 用于 libtspi 和 tpm 通信的 Go 绑定与支持代码 [![Build Status (Travis)](https://travis-ci.org/google/go-tspi.svg?branch=master)](https://travis-ci.org/google/go-tspi) 这是一个提供了一组绑定的库,用于实现以下通信: 使用 Go 编写的代码与 libtspi(负责提供 TPM 控制接口的库)之间的通信。它由以下组件组成: ## tspi Go 的 tspi 绑定。这是一个底层接口,旨在供 使用 Go 编写新的使用 TPM 的应用程序的开发者使用。使用这些绑定的代码必须 运行在与 TPM 相同的系统上。例如: ``` // Create a new TSPI context context, err := tspi.NewContext() // Connect to the TPM daemon context.connect() // Obtain a handle to the TPM itself tpm := context.GetTPM() // Obtain the TPM event log log, err := tpm.GetEventLog() ``` ## 证明与验证 用于执行与证明 (attestation) 相关任务的辅助函数 ``` // Retrieve the EK certificate ekcert, err := attestation.GetEKCert(context) // Verify that the EK certificate is signed by a TPM vendor err = verification.VerifyEKCert(ekcert) if err != nil { log.Fatal("Unable to verify EK certificate!") } ``` ## tpmd 通过更高级别的 API 或通过网络执行特定 TPM 操作的守护进程 (daemon)。将监听端口号作为唯一参数。 ## tpmclient 用于与 tpmd 通信的客户端应用程序库。避免了 各个应用程序自行关注 TSPI 上下文或资源生命周期的需要。 ``` `// Connect to the TPM daemon on localhost port 12401 client := tpmclient.New("127.0.0.1:12401") // Extend a PCR with some data data := []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08} client.Extend(15, 0x1000, data, "Test extension")` ```
标签:EVTX分析, Golang, TSPI绑定, 加密库, 可信平台模块(TPM), 安全编程, 日志审计, 系统硬件, 远程证明