cache

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProdTypeSGX = "sgx"
	ProdTypeTDX = "tdx"
)

Constants for product types

View Source
const (
	UpdateTypeStandard = "standard"
	UpdateTypeEarly    = "early"
)

Constants for update types

View Source
const (
	IdentityQE   = "1" // QE (Quoting Enclave)
	IdentityQVE  = "2" // QVE (Quote Verification Enclave)
	IdentityTDQE = "3" // TDQE (TD Quoting Enclave)
)

Constants for enclave identity IDs

View Source
const (
	CAProcessor = "processor"
	CAPlatform  = "platform"
)

Constants for CA types

View Source
const (
	PlatformRegNew          = 0
	PlatformRegNotAvailable = 1
	PlatformRegDeleted      = 9
)

Constants for registration states

Variables

This section is empty.

Functions

This section is empty.

Types

type CertChain

type CertChain struct {
	CA        string `json:"ca"`
	RootCert  string `json:"root_cert"`
	IntmdCert string `json:"intmd_cert,omitempty"`
}

CertChain represents a certificate chain

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB wraps PebbleDB for caching SGX attestation collaterals

func Open

func Open(path string) (*DB, error)

Open opens or creates a PebbleDB at the given path

func (*DB) Close

func (d *DB) Close() error

Close closes the database

func (*DB) DeleteRegisteredPlatform

func (d *DB) DeleteRegisteredPlatform(qeID, pceID, cpuSVN, pceSVN string) error

DeleteRegisteredPlatform removes a registered platform from queue

func (*DB) GetAllCerts

func (d *DB) GetAllCerts(qeID, pceID string) (map[string][]byte, error)

GetAllCerts retrieves all certificates for a platform

func (*DB) GetAllFMSPCs

func (d *DB) GetAllFMSPCs() []string

GetAllFMSPCs returns all unique FMSPCs in the database

func (*DB) GetAllPlatforms

func (d *DB) GetAllPlatforms() ([]*Platform, error)

GetAllPlatforms returns all platforms in the database

func (*DB) GetAllRegisteredPlatforms

func (d *DB) GetAllRegisteredPlatforms() ([]*RegisteredPlatform, error)

GetAllRegisteredPlatforms returns all registered platforms in queue

func (*DB) GetAppraisalPolicy

func (d *DB) GetAppraisalPolicy(fmspc string) ([]byte, error)

GetAppraisalPolicy retrieves appraisal policy for a specific FMSPC

func (*DB) GetCRL

func (d *DB) GetCRL(ca string) ([]byte, error)

GetCRL retrieves a CRL for a CA

func (*DB) GetCRLByURI

func (d *DB) GetCRLByURI(uri string) ([]byte, error)

GetCRLByURI retrieves CRL by URI

func (*DB) GetCert

func (d *DB) GetCert(qeID, pceID, tcbm string) ([]byte, error)

GetCert retrieves a cached PCK certificate

func (*DB) GetCertChain

func (d *DB) GetCertChain(ca string) (*CertChain, error)

GetCertChain retrieves certificate chain for a CA

func (*DB) GetIdentity

func (d *DB) GetIdentity(id, version, updateType string) ([]byte, error)

GetIdentity retrieves enclave identity

func (*DB) GetPlatform

func (d *DB) GetPlatform(qeID, pceID string) (*Platform, error)

GetPlatform retrieves platform information

func (*DB) GetPlatformTCB

func (d *DB) GetPlatformTCB(qeID, pceID, cpuSVN, pceSVN string) (string, error)

GetPlatformTCB retrieves TCBm for a specific platform TCB level

func (*DB) GetPlatformsByFMSPC

func (d *DB) GetPlatformsByFMSPC(fmspcs []string) ([]*Platform, error)

GetPlatformsByFMSPC returns platforms with specific FMSPCs

func (*DB) GetRegisteredPlatform

func (d *DB) GetRegisteredPlatform(qeID, pceID, cpuSVN, pceSVN string) (*RegisteredPlatform, error)

GetRegisteredPlatform retrieves a registered platform from queue

func (*DB) GetRootCACRL

func (d *DB) GetRootCACRL(rootca string) ([]byte, error)

GetRootCACRL retrieves root CA CRL

func (*DB) GetTCBInfo

func (d *DB) GetTCBInfo(prodType, fmspc, version, updateType string) ([]byte, error)

GetTCBInfo retrieves TCB information

func (*DB) PutAppraisalPolicy

func (d *DB) PutAppraisalPolicy(fmspc string, policy []byte) error

PutAppraisalPolicy stores an appraisal policy for a specific FMSPC

func (*DB) PutCRL

func (d *DB) PutCRL(ca string, crl []byte) error

PutCRL stores a CRL for a CA

func (*DB) PutCRLByURI

func (d *DB) PutCRLByURI(uri string, crl []byte) error

PutCRLByURI stores CRL by URI

func (*DB) PutCert

func (d *DB) PutCert(qeID, pceID, tcbm string, cert []byte) error

PutCert stores a PCK certificate

func (*DB) PutCertChain

func (d *DB) PutCertChain(ca string, chain *CertChain) error

PutCertChain stores certificate chain for a CA

func (*DB) PutIdentity

func (d *DB) PutIdentity(id, version, updateType string, identity []byte) error

PutIdentity stores enclave identity

func (*DB) PutPlatform

func (d *DB) PutPlatform(qeID, pceID string, platform *Platform) error

PutPlatform stores platform information

func (*DB) PutPlatformTCB

func (d *DB) PutPlatformTCB(qeID, pceID, cpuSVN, pceSVN, tcbm string) error

PutPlatformTCB stores TCBm for a specific platform TCB level

func (*DB) PutRegisteredPlatform

func (d *DB) PutRegisteredPlatform(qeID, pceID, cpuSVN, pceSVN string, regPlatform *RegisteredPlatform) error

PutRegisteredPlatform stores a registered platform in queue

func (*DB) PutRootCACRL

func (d *DB) PutRootCACRL(rootca string, crl []byte) error

PutRootCACRL stores root CA CRL

func (*DB) PutTCBInfo

func (d *DB) PutTCBInfo(prodType, fmspc, version, updateType string, tcbInfo []byte) error

PutTCBInfo stores TCB information

type Platform

type Platform struct {
	QEID             string `json:"qe_id"`
	PCEID            string `json:"pce_id"`
	PlatformManifest string `json:"platform_manifest,omitempty"`
	EncPPID          string `json:"enc_ppid,omitempty"`
	FMSPC            string `json:"fmspc"`
	CA               string `json:"ca"` // "processor" or "platform"
}

Platform represents a registered SGX platform

type RegisteredPlatform

type RegisteredPlatform struct {
	QEID             string `json:"qe_id"`
	PCEID            string `json:"pce_id"`
	CPUSVN           string `json:"cpu_svn"`
	PCESVN           string `json:"pce_svn"`
	EncPPID          string `json:"enc_ppid,omitempty"`
	PlatformManifest string `json:"platform_manifest,omitempty"`
	State            int    `json:"state"` // 0 = new, 1 = not available, 9 = deleted
}

RegisteredPlatform represents a platform in the registration queue (OFFLINE mode)

Jump to

Keyboard shortcuts

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