cosign

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SigstoreBundleMediaTypePrefix = "application/vnd.dev.sigstore.bundle"

SigstoreBundleMediaTypePrefix is the media type prefix for Sigstore Protobuf Bundle format (v0.1/v0.2/v0.3).

Variables

This section is empty.

Functions

func HashData

func HashData(data []byte) []byte

func ParseCertificateDER added in v1.11.0

func ParseCertificateDER(derBytes []byte) (*ecdsa.PublicKey, error)

ParseCertificateDER parses a raw DER-encoded X.509 certificate and returns its ECDSA public key. This is used for Sigstore Protobuf Bundles, which store the signing certificate as base64-encoded raw DER bytes rather than PEM.

func ParsePublicKey

func ParsePublicKey(pemEncodedPubKey []byte) (*ecdsa.PublicKey, error)

func VerifySignature

func VerifySignature(pubKey *ecdsa.PublicKey, hash, signature []byte) (bool, error)

VerifySignature verifies the signature of the data using the provided ECDSA public key.

Types

type Bundle

type Bundle struct {
	Signature   string `json:"base64Signature"`
	Certificate string `json:"cert"`
	RekorBundle Rekor  `json:"rekorBundle"`
}

Bundle is the legacy cosign bundle format (produced with cosign sign-blob --bundle). The certificate is PEM-encoded and the signature is base64.

type Payload

type Payload struct {
	Body           string `json:"body"`
	IntegratedTime int64  `json:"integratedTime"`
	LogIndex       int64  `json:"logIndex"`
	LogID          string `json:"logID"`
}

type Rekor

type Rekor struct {
	SignedEntryTimestamp string  `json:"SignedEntryTimestamp"`
	Payload              Payload `json:"Payload"`
}

type SigstoreBundle added in v1.11.0

type SigstoreBundle struct {
	MediaType            string                       `json:"mediaType"`
	VerificationMaterial SigstoreVerificationMaterial `json:"verificationMaterial"`
	MessageSignature     *SigstoreMessageSignature    `json:"messageSignature,omitempty"`
}

SigstoreBundle is the new Sigstore Protobuf Bundle format (application/vnd.dev.sigstore.bundle+json). It bundles the verification material (certificate or public key) with the message signature and optional transparency log entries.

Spec: https://github.com/sigstore/protobuf-specs

func (*SigstoreBundle) IsSigstoreBundle added in v1.11.0

func (b *SigstoreBundle) IsSigstoreBundle() bool

IsSigstoreBundle returns true when the bundle's media type identifies it as a Sigstore Protobuf Bundle.

func (*SigstoreBundle) LeafCertificate added in v1.11.0

func (b *SigstoreBundle) LeafCertificate() string

LeafCertificate returns the raw (base64 DER) leaf signing certificate from either the v0.3+ `certificate` field or the legacy v0.1 `x509CertificateChain.certificates[0]` location.

type SigstoreMessageDigest added in v1.11.0

type SigstoreMessageDigest struct {
	Algorithm string `json:"algorithm"`
	Digest    string `json:"digest"`
}

type SigstoreMessageSignature added in v1.11.0

type SigstoreMessageSignature struct {
	MessageDigest *SigstoreMessageDigest `json:"messageDigest,omitempty"`
	Signature     string                 `json:"signature"`
}

type SigstorePublicKeyIdentifier added in v1.11.0

type SigstorePublicKeyIdentifier struct {
	Hint string `json:"hint"`
}

type SigstoreVerificationMaterial added in v1.11.0

type SigstoreVerificationMaterial struct {
	// Certificate is the leaf signing certificate (raw DER, base64 encoded in JSON).
	Certificate *SigstoreX509Certificate `json:"certificate,omitempty"`
	// PublicKey references a public key by hint (used for keyed signing).
	PublicKey *SigstorePublicKeyIdentifier `json:"publicKey,omitempty"`
	// X509CertificateChain is the legacy v0.1 location for the signing cert
	// (kept for compatibility with bundles emitted by older tooling).
	X509CertificateChain *SigstoreX509CertificateChain `json:"x509CertificateChain,omitempty"`
}

type SigstoreX509Certificate added in v1.11.0

type SigstoreX509Certificate struct {
	RawBytes string `json:"rawBytes"`
}

type SigstoreX509CertificateChain added in v1.11.0

type SigstoreX509CertificateChain struct {
	Certificates []SigstoreX509Certificate `json:"certificates,omitempty"`
}

Jump to

Keyboard shortcuts

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