nitrofake

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package nitrofake provides an Attestor that produces structurally valid COSE Sign1 attestation documents. These documents pass the local Nitro attestation validator's full validation chain (CBOR parsing, cert chain, ECDSA signature, UserData, PCRs) without requiring real Nitro hardware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attestor

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

Attestor produces structurally valid COSE Sign1 attestation documents that pass the local Nitro validator with a custom CA root.

func NewAttestor

func NewAttestor() (*Attestor, error)

NewAttestor generates a self-signed P-384 root CA, a leaf cert signed by that root, and deterministic 48-byte fake PCR values.

func (*Attestor) CARoots

func (f *Attestor) CARoots() *x509.CertPool

CARoots returns an x509.CertPool containing the fake root CA certificate.

func (*Attestor) CARootsPEM

func (f *Attestor) CARootsPEM() string

CARootsPEM returns the root CA certificate in PEM format.

func (*Attestor) CreateAttestation

func (f *Attestor) CreateAttestation(userData []byte, opts ...Option) ([]byte, error)

CreateAttestation builds a COSE Sign1 document encoding a Nitro-like attestation with the given userData. Optional nonce and public_key fields can be set via opts.

func (*Attestor) LeafPublicKeyDER

func (f *Attestor) LeafPublicKeyDER() ([]byte, error)

LeafPublicKeyDER returns the SPKI (DER) encoding of the leaf certificate public key, matching the format of nitro.Document.LeafPublicKey.

func (*Attestor) TrustedPCRsJSON

func (f *Attestor) TrustedPCRsJSON() []byte

TrustedPCRsJSON returns the PCR values as a JSON object matching the format expected by the attestation validator.

type Option

type Option func(*attestationDocument)

Option customizes the optional fields of a fake attestation document.

func WithNonce

func WithNonce(nonce []byte) Option

WithNonce sets the attestation nonce field.

func WithPublicKey

func WithPublicKey(publicKey []byte) Option

WithPublicKey sets the attestation public_key field, modeling an enclave that publishes a long-lived identity key.

Jump to

Keyboard shortcuts

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