Documentation ¶
Overview ¶
Package gcetcbendorsement provides functions for interpreting VMLaunchEndorsements.
Index ¶
- Constants
- Variables
- func InspectMask(ctx context.Context, endorsement *epb.VMLaunchEndorsement, ...) error
- func InspectPayload(ctx context.Context, endorsement *epb.VMLaunchEndorsement) error
- func InspectSignature(ctx context.Context, endorsement *epb.VMLaunchEndorsement) error
- func OpensslVerifyCertShellCmd(self, endorsement, root string) string
- func OpensslVerifyShellCmd(self, endorsement string) string
- func SevPolicy(ctx context.Context, endorsement *epb.VMLaunchEndorsement, ...) (*cpb.Policy, error)
- func SevValidate(ctx context.Context, attestation *spb.Attestation, opts *SevValidateOptions) error
- func TdxPolicy(ctx context.Context, endorsement *epb.VMLaunchEndorsement, ...) (*tcpb.Policy, error)
- func TdxValidate(ctx context.Context, attestation []byte, opts *TdxValidateOptions) error
- func WithInspect(ctx context.Context, i *Inspect) context.Context
- func WriteBytesForm(bytes []byte, form BytesForm, w TerminalWriter) error
- type BytesForm
- type FieldRenderer
- type Inspect
- type MaskOptions
- type NonterminalWriter
- type OSFileWriter
- type SevPolicyOptions
- type SevValidateOptions
- type TdxPolicyOptions
- type TdxValidateOptions
- type TerminalWriter
Constants ¶
const ( // DefaultRootURL is the trusted location of the GCE Confidential Computing TCB signing key root // certificate. DefaultRootURL = "https://pki.goog/cloud_integrity/GCE-cc-tcb-root_1.crt" // DefaultRootCmd is a shell command for use as a path to the root certificate. DefaultRootCmd = "<(curl " + DefaultRootURL + ")" )
Variables ¶
var ( // ErrNoInspect is returned when no Inspect is found in the context. ErrNoInspect = errors.New("no Inspect found in context") )
Functions ¶
func InspectMask ¶
func InspectMask(ctx context.Context, endorsement *epb.VMLaunchEndorsement, mask *fmpb.FieldMask) error
InspectMask outputs the masked fields of the endorsement's golden measurement.
func InspectPayload ¶
func InspectPayload(ctx context.Context, endorsement *epb.VMLaunchEndorsement) error
InspectPayload outputs the signature of the endorsement.
func InspectSignature ¶
func InspectSignature(ctx context.Context, endorsement *epb.VMLaunchEndorsement) error
InspectSignature outputs the signature of the endorsement.
func OpensslVerifyCertShellCmd ¶
OpensslVerifyCertShellCmd returns the shell command for using openssl to verify the code- signing certificate inside the endorsement in path `endorsement` as extracted by the gcetcbendorsement CLI tool at the `self` path. The `endorsement` path must be to a file containing a binary-serialized VMLaunchEndorsement.
func OpensslVerifyShellCmd ¶
OpensslVerifyShellCmd returns the shell command for using openssl and the gcetcbendorsement CLI tool at path `self` to verify the endorsement at path `endorsement` signature. The `endorsement` path must be to a file containing a binary-serialized VMLaunchEndorsement.
func SevPolicy ¶
func SevPolicy(ctx context.Context, endorsement *epb.VMLaunchEndorsement, opts *SevPolicyOptions) (*cpb.Policy, error)
SevPolicy extends a base go-sev-guest validation policy with reference values contained in the endorsement.
func SevValidate ¶
func SevValidate(ctx context.Context, attestation *spb.Attestation, opts *SevValidateOptions) error
SevValidate validates an attestation against the given or extracted endorsement and an optional base policy.
func TdxPolicy ¶
func TdxPolicy(ctx context.Context, endorsement *epb.VMLaunchEndorsement, opts *TdxPolicyOptions) (*tcpb.Policy, error)
TdxPolicy extends a base go-tdx-guest validation policy with reference values contained in the endorsement.
func TdxValidate ¶
func TdxValidate(ctx context.Context, attestation []byte, opts *TdxValidateOptions) error
TdxValidate validates an attestation against the given or extracted endorsement and an optional base policy.
func WithInspect ¶
WithInspect returns a context with the inspect options added.
func WriteBytesForm ¶
func WriteBytesForm(bytes []byte, form BytesForm, w TerminalWriter) error
WriteBytesForm writes bytes according to a BytesForm to the given TerminalWriter.
Types ¶
type BytesForm ¶
type BytesForm int
BytesForm is the type of form to use for rendering `bytes` fields.
const ( // BytesRaw instructs Mask to write `bytes` fields as a raw string. BytesRaw BytesForm = iota // BytesHex instructs Mask to write `bytes` fields with a hex-encoded string. BytesHex // BytesHexGuidify instructs Mask to write `bytes` fields with a hex-encoded string unless 16 // bytes long. If 16 bytes long, render as a GUID. BytesHexGuidify // BytesBase64 instructs Mask to write `bytes` fields with a base64-encoded string. BytesBase64 // BytesAuto is instructs Mask to write `bytes` fields in a form dependent on the writer. If the // writer is terminal, then it uses a base64-encoded string. If it's not a terminal, it uses raw // binary. BytesAuto )
func ParseBytesForm ¶
ParseBytesForm parses a BytesForm option name to the corresponding constant.
type FieldRenderer ¶
type FieldRenderer func(*MaskOptions, protopathIndex) error
FieldRenderer is called on fields that are present at the path this function is mapped to.
func RenderTimestamp ¶
func RenderTimestamp(timeFormat string) FieldRenderer
RenderTimestamp return a FieldRenderer for a Timestamp message using a given Golang time format string.
type Inspect ¶
type Inspect struct { Writer TerminalWriter Form BytesForm }
Inspect represents arguments to the VMLaunchEndorsement inspect command.
type MaskOptions ¶
type MaskOptions struct { BytesForm BytesForm Writer TerminalWriter PathRenderer map[string]FieldRenderer }
MaskOptions contains options for rendering named fields in a VMGoldenMeasurement.
type NonterminalWriter ¶
NonterminalWriter wraps the io.Writer interface while also making IsTerminal() always return false.
func (NonterminalWriter) IsTerminal ¶
func (w NonterminalWriter) IsTerminal() bool
IsTerminal returns false.
type OSFileWriter ¶
OSFileWriter wraps the os.File interface while also making IsTerminal() return whether the file's encapsulated file descriptor is a TTY.
func (OSFileWriter) IsTerminal ¶
func (w OSFileWriter) IsTerminal() bool
IsTerminal returns whether the file's encapsulated file descriptor is a TTY.
type SevPolicyOptions ¶
type SevPolicyOptions struct { Base *cpb.Policy // LaunchVmsas is the number of expected Vmsas the VM was launched with. A policy is limited to // check a single measurement. LaunchVmsas uint32 // Overwrite if false, it is an error for reference values from Endorsement to overwrite the // associated fields in the Base policy. Overwrite bool // AllowUnspecifiedVmsas indicates that LaunchVmsas == 0 should not be an error, and the // measurement should be disregarded. AllowUnspecifiedVmsas bool }
SevPolicyOptions contains options for modifying a go-sev-guest validation policy from an endorsement.
type SevValidateOptions ¶
type SevValidateOptions struct { Endorsement *epb.VMLaunchEndorsement BasePolicy *cpb.Policy Overwrite bool RootsOfTrust *x509.CertPool Now time.Time Getter verify.HTTPSGetter ExpectedLaunchVmsas uint32 TestonlyForceGCS bool }
SevValidateOptions holds options for the sev-validate command.
type TdxPolicyOptions ¶
type TdxPolicyOptions struct { Base *tcpb.Policy // RAMGiB is the amount of RAM that the VM launched with as accounted by its TDHOB. RAMGiB int // Overwrite indicates that the policy should be modified even if it already has values. Overwrite bool }
TdxPolicyOptions contains options for modifying a go-tdx-guest validation policy from an endorsement.
type TdxValidateOptions ¶
type TdxValidateOptions struct { Endorsement *epb.VMLaunchEndorsement BasePolicy *tcpb.Policy Overwrite bool RootsOfTrust *x509.CertPool Now time.Time Getter verify.HTTPSGetter ExpectedRAMGiB int }
TdxValidateOptions holds options for the tdx-validate command.
type TerminalWriter ¶
type TerminalWriter interface { // Write writes len(p) bytes from p to the underlying data stream. // It returns the number of bytes written from p (0 <= n <= len(p)) // and any error encountered that caused the write to stop early. // Write must return a non-nil error if it returns n < len(p). // Write must not modify the slice data, even temporarily. Write([]byte) (int, error) // IsTerminal returns true if the writer is a terminal. IsTerminal() bool }
TerminalWriter is an io.Writer that can determine if it's a terminal or not.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
The gcetcbendorsement command provides a CLI tool for interpreting the UEFI binary endorsement.
|
The gcetcbendorsement command provides a CLI tool for interpreting the UEFI binary endorsement. |
Package cmd provides the gcetcbendorsement CLI command abstractions.
|
Package cmd provides the gcetcbendorsement CLI command abstractions. |
Package parsepath provides a parser for the protopath syntax of referencing fields within a protobuf.
|
Package parsepath provides a parser for the protopath syntax of referencing fields within a protobuf. |
Package testing provides helpers for testing gcetcbendorsement.
|
Package testing provides helpers for testing gcetcbendorsement. |