...

Package spiffe

import "github.com/in-toto/in-toto-golang/internal/spiffe"
Overview
Index

Overview ▾

type SVIDDetails

SVIDDetails captures the Private Key, Root and Intermediate Certificate from the SVID provided by spire for the workload.

type SVIDDetails struct {
    PrivateKey    crypto.Signer
    Certificate   *x509.Certificate
    Intermediates []*x509.Certificate
}

func GetSVID

func GetSVID(ctx context.Context, client SVIDFetcher) (SVIDDetails, error)

GetSVID attempts to request an SVID from the provided SPIRE Workload API socket. If attestation succeeds and an SVID is acquired the resulting X509 key & certificate pair will be returned as well as any intermediate certificates needed to establish trust to trust domain's root.

func (SVIDDetails) InTotoKey

func (s SVIDDetails) InTotoKey() (intoto.Key, error)

InTotoKey uses the private key and certificate obtained from Spire to initialize intoto.key to be used for signing.

type SVIDFetcher

SVIDFetcher uses the context to connect to the spire and get the SVID associated with the workload.

type SVIDFetcher interface {
    FetchX509Context(ctx context.Context) (*workloadapi.X509Context, error)
    Close() error
}

func NewClient

func NewClient(ctx context.Context, socketPath string) (SVIDFetcher, error)

NewClient takes the context and the provided spire agent socket path in order to initialize the workload API.