tpm2

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package tpm2 provides TPM2.0 related functionality helpers.

Package tpm2 provides TPM2.0 related functionality helpers.

Package tpm2 provides TPM2.0 related functionality helpers.

Package tpm2 provides TPM2.0 related functionality helpers.

Package tpm2 provides TPM2.0 related functionality helpers.

Package tpm2 provides TPM2.0 related functionality helpers.

Package tpm2 provides TPM2.0 related functionality helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculatePolicy

func CalculatePolicy(pcrValue []byte, pcrSelection tpm2.TPMLPCRSelection) ([]byte, error)

CalculatePolicy calculates the policy hash for a given PCR value and PCR selection.

func CalculateSealingPolicyDigest

func CalculateSealingPolicyDigest(pcrValue []byte, pcrSelection tpm2.TPMLPCRSelection, pubKey string) ([]byte, error)

CalculateSealingPolicyDigest calculates the sealing policy digest for a given PCR value, PCR selection and public key.

func CreateSelector

func CreateSelector(pcrs []int) ([]byte, error)

CreateSelector converts PCR numbers into a bitmask.

func PCRExtent

func PCRExtent(pcr int, data []byte) error

PCRExtent hashes the input and extends the PCR with the hash.

func ParsePCRSigningPubKey

func ParsePCRSigningPubKey(file string) (*rsa.PublicKey, error)

ParsePCRSigningPubKey parses a PEM encoded RSA public key.

func PolicyPCRDigest

func PolicyPCRDigest(t transport.TPM, policyHandle tpm2.TPMHandle, pcrSelection tpm2.TPMLPCRSelection) (*tpm2.TPM2BDigest, error)

PolicyPCRDigest executes policyPCR and returns the digest.

func RSAPubKeyTemplate

func RSAPubKeyTemplate(bitlen, exponent int, modulus []byte) tpm2.TPMTPublic

RSAPubKeyTemplate returns a TPM2.0 public key template for RSA keys.

func ReadPCR

func ReadPCR(t transport.TPM, pcr int) ([]byte, error)

ReadPCR reads the value of a single PCR.

func Unseal

func Unseal(sealed SealedResponse) ([]byte, error)

Unseal unseals a sealed blob using the TPM

Types

type BankData

type BankData struct {
	// list of PCR banks
	PCRs []int `json:"pcrs"`
	// Public key of the TPM
	PKFP string `json:"pkfp"`
	// Policy digest
	Pol string `json:"pol"`
	// Signature of the policy digest in base64
	Sig string `json:"sig"`
}

BankData constains data for a specific PCR bank.

type PCRData

type PCRData struct {
	SHA1   []BankData `json:"sha1,omitempty"`
	SHA256 []BankData `json:"sha256,omitempty"`
	SHA384 []BankData `json:"sha384,omitempty"`
	SHA512 []BankData `json:"sha512,omitempty"`
}

PCRData is the data structure for PCR signature json.

func ParsePCRSignature

func ParsePCRSignature() (*PCRData, error)

ParsePCRSignature parses the PCR signature json file.

type SealedResponse

type SealedResponse struct {
	SealedBlobPrivate []byte
	SealedBlobPublic  []byte
	KeyName           []byte
	PolicyDigest      []byte
}

SealedResponse is the response from the TPM2.0 Seal operation.

func Seal

func Seal(key []byte) (*SealedResponse, error)

Seal seals the key using TPM2.0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL