dsse

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

View Source
const PemTypeCertificate = "CERTIFICATE"

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	Payload     []byte      `json:"payload"`
	PayloadType string      `json:"payloadType"`
	Signatures  []Signature `json:"signatures"`
}

func Sign

func Sign(bodyType string, body io.Reader, opts ...SignOption) (Envelope, error)

func (Envelope) Verify

func (e Envelope) Verify(opts ...VerificationOption) ([]PassedVerifier, error)

type ErrInvalidThreshold

type ErrInvalidThreshold int

func (ErrInvalidThreshold) Error

func (e ErrInvalidThreshold) Error() string

type ErrNoMatchingSigs

type ErrNoMatchingSigs struct{}

func (ErrNoMatchingSigs) Error

func (e ErrNoMatchingSigs) Error() string

type ErrNoSignatures

type ErrNoSignatures struct{}

func (ErrNoSignatures) Error

func (e ErrNoSignatures) Error() string

type ErrThresholdNotMet

type ErrThresholdNotMet struct {
	Theshold int
	Acutal   int
}

func (ErrThresholdNotMet) Error

func (e ErrThresholdNotMet) Error() string

type PassedVerifier

type PassedVerifier struct {
	Verifier                 cryptoutil.Verifier
	PassedTimestampVerifiers []TimestampVerifier
}

type SignOption

type SignOption func(*signOptions)

func SignWithSigners

func SignWithSigners(signers ...cryptoutil.Signer) SignOption

func SignWithTimestampers

func SignWithTimestampers(timestampers ...Timestamper) SignOption

type Signature

type Signature struct {
	KeyID         string               `json:"keyid"`
	Signature     []byte               `json:"sig"`
	Certificate   []byte               `json:"certificate,omitempty"`
	Intermediates [][]byte             `json:"intermediates,omitempty"`
	Timestamps    []SignatureTimestamp `json:"timestamps,omitempty"`
}

type SignatureTimestamp

type SignatureTimestamp struct {
	Type SignatureTimestampType `json:"type"`
	Data []byte                 `json:"data"`
}

type SignatureTimestampType

type SignatureTimestampType string
const TimestampRFC3161 SignatureTimestampType = "tsp"

type TimestampVerifier

type TimestampVerifier interface {
	Verify(context.Context, io.Reader, io.Reader) (time.Time, error)
}

type Timestamper

type Timestamper interface {
	Timestamp(context.Context, io.Reader) ([]byte, error)
}

type VerificationOption

type VerificationOption func(*verificationOptions)

func VerifyWithIntermediates

func VerifyWithIntermediates(intermediates ...*x509.Certificate) VerificationOption

func VerifyWithRoots

func VerifyWithRoots(roots ...*x509.Certificate) VerificationOption

func VerifyWithThreshold

func VerifyWithThreshold(threshold int) VerificationOption

func VerifyWithTimestampVerifiers

func VerifyWithTimestampVerifiers(verifiers ...TimestampVerifier) VerificationOption

func VerifyWithVerifiers

func VerifyWithVerifiers(verifiers ...cryptoutil.Verifier) VerificationOption

Jump to

Keyboard shortcuts

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