Documentation ¶
Overview ¶
Copyright 2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func NewTpmAttestDefault() tpm2.AttestationData
- type Algorithm
- type AttestationInfo
- type CertInfo
- type DigestInfo
- type Evidence
- func (e *Evidence) FromCBOR(buf []byte) error
- func (e *Evidence) FromJSON(data []byte) error
- func (e *Evidence) SetTokens(k *KAT, p *PAT) error
- func (e Evidence) Sign(data []byte, alg Algorithm, key crypto.PrivateKey) ([]byte, error)
- func (e Evidence) ToCBOR() ([]byte, error)
- func (e Evidence) ToJSON() ([]byte, error)
- func (e Evidence) Verify(key crypto.PublicKey) error
- type KAT
- func (k KAT) DecodeCertInfo() (*CertInfo, error)
- func (k KAT) DecodePubArea() (crypto.PublicKey, error)
- func (k *KAT) EncodeCertInfo(nonce []byte) error
- func (k *KAT) EncodePubArea(alg Algorithm, key crypto.PublicKey) error
- func (k *KAT) SetKeyID(v []byte) error
- func (k *KAT) SetSig(s []byte) error
- func (k *KAT) SetTpmVer(v string) error
- func (k KAT) Validate() error
- func (k KAT) Verify(key crypto.PublicKey) error
- type PAT
- func (p *PAT) EncodeAttestationInfo(attInfo *AttestationInfo) error
- func (p PAT) GetAttestationInfo() (*AttestationInfo, error)
- func (p *PAT) SetKeyID(v []byte) error
- func (p *PAT) SetSig(s []byte) error
- func (p *PAT) SetTpmVer(v string) error
- func (p PAT) Validate() error
- func (p PAT) Verify(key crypto.PublicKey) error
- type PCRDetails
- type PCRInfo
Constants ¶
const ( DefaultTPMHandle = tpmutil.Handle(100) TpmMagic = 0xff544347 )
const ( InValidAlgorithm = 0 AlgorithmES256 = 1 AlgorithmES384 = 2 AlgorithmES512 = 3 )
const (
UnSupportedAlg = 0
)
HashAlgID represents a IANA Supported Hash Algorithms
Variables ¶
This section is empty.
Functions ¶
func NewTpmAttestDefault ¶
func NewTpmAttestDefault() tpm2.AttestationData
Types ¶
type AttestationInfo ¶
type AttestationInfo struct { Nonce []byte PCR PCRDetails }
type CertInfo ¶
type CertInfo struct { Nonce []byte Name DigestInfo }
type DigestInfo ¶
type Evidence ¶
Evidence is a collection of Parsec TPM Key and Platform Attestation objects
func (*Evidence) FromCBOR ¶
FromCBOR extracts & validates key and platform attestation token from the serialized CBOR collection
func (*Evidence) FromJSON ¶
FromJSON extracts & validates key and platform attestation tokens from the serialized JSON bytes
func (Evidence) Sign ¶
Sign signs the given data using the supplied algorithm and private key and returns signature bytes which is an encoded TPMT_SIGNATURE Structure
func (Evidence) ToCBOR ¶
ToCBOR takes key and platform attestation tokens from Evidence and serializes them into valid a CBOR
type KAT ¶
type KAT struct { TpmVer *string `cbor:"tpmVer" json:"tpmVer"` KID *[]byte `cbor:"kid" json:"kid"` Sig *[]byte `cbor:"sig" json:"sig"` PubArea *[]byte `cbor:"pubArea" json:"pubArea"` CertInfo *[]byte `cbor:"certInfo" json:"certInfo"` }
func (KAT) DecodeCertInfo ¶
func (KAT) DecodePubArea ¶
DecodePubArea decodes a given public key, from TPMT_PUBLIC structure
func (*KAT) EncodeCertInfo ¶
type PAT ¶
type PAT struct { TpmVer *string `cbor:"tpmVer" json:"tpmVer"` KID *[]byte `cbor:"kid" json:"kid"` Sig *[]byte `cbor:"sig" json:"sig"` // This is TPMT_SIGNATURE AttestInfo *[]byte `cbor:"attestInfo" json:"attestInfo"` }
PAT is a structure to wrap Platform Attestation Token
func (*PAT) EncodeAttestationInfo ¶
func (p *PAT) EncodeAttestationInfo(attInfo *AttestationInfo) error
func (PAT) GetAttestationInfo ¶
func (p PAT) GetAttestationInfo() (*AttestationInfo, error)
GetAttestationInfo only decodes relevant information from TPM2 library and sets in the returned structure correctly