types

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: BSD-2-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EndpointAddLeaf             = Endpoint("add-leaf")
	EndpointAddCosignature      = Endpoint("add-cosignature")
	EndpointGetNextTreeHead     = Endpoint("get-next-tree-head")
	EndpointGetTreeHead         = Endpoint("get-tree-head")
	EndpointGetInclusionProof   = Endpoint("get-inclusion-proof/")
	EndpointGetConsistencyProof = Endpoint("get-consistency-proof/")
	EndpointGetLeaves           = Endpoint("get-leaves/")

	EndpointGetTreeHeadUnsigned = Endpoint("get-tree-head-unsigned")
)
View Source
const (
	SignedTreeHeadNamespace   = "signed-tree-head:v0@sigsum.org"
	CosignedTreeHeadNamespace = "cosigned-tree-head:v0@sigsum.org"
)
View Source
const (
	TreeLeafNamespace = "tree-leaf:v0@sigsum.org"
)

Variables

This section is empty.

Functions

func LeavesToASCII added in v0.1.6

func LeavesToASCII(w io.Writer, leaves []Leaf) error

func SignLeafChecksum added in v0.1.3

func SignLeafChecksum(signer crypto.Signer, checksum *crypto.Hash) (crypto.Signature, error)

func SignLeafMessage added in v0.1.3

func SignLeafMessage(signer crypto.Signer, msg []byte) (crypto.Signature, error)

func VerifyLeafChecksum added in v0.1.3

func VerifyLeafChecksum(key *crypto.PublicKey, checksum *crypto.Hash, sig *crypto.Signature) bool

func VerifyLeafMessage added in v0.1.3

func VerifyLeafMessage(key *crypto.PublicKey, msg []byte, sig *crypto.Signature) bool

Types

type ConsistencyProof

type ConsistencyProof struct {
	NewSize uint64
	OldSize uint64
	Path    []crypto.Hash
}

func (*ConsistencyProof) FromASCII

func (pr *ConsistencyProof) FromASCII(r io.Reader, oldSize, newSize uint64) error

func (*ConsistencyProof) ToASCII

func (pr *ConsistencyProof) ToASCII(w io.Writer) error

func (*ConsistencyProof) Verify

func (pr *ConsistencyProof) Verify(oldRoot, newRoot *crypto.Hash) error

type Cosignature added in v0.1.6

type Cosignature struct {
	KeyHash   crypto.Hash
	Timestamp uint64
	Signature crypto.Signature
}

func (*Cosignature) FromASCII added in v0.1.13

func (cs *Cosignature) FromASCII(r io.Reader) error

func (*Cosignature) ToASCII added in v0.1.6

func (cs *Cosignature) ToASCII(w io.Writer) error

func (*Cosignature) Verify added in v0.1.14

func (cs *Cosignature) Verify(key *crypto.PublicKey, logKeyHash *crypto.Hash, th *TreeHead) bool

type CosignedTreeHead

type CosignedTreeHead struct {
	SignedTreeHead
	Cosignatures []Cosignature
}

func (*CosignedTreeHead) FromASCII

func (cth *CosignedTreeHead) FromASCII(r io.Reader) error

func (*CosignedTreeHead) ToASCII

func (cth *CosignedTreeHead) ToASCII(w io.Writer) error

type Endpoint

type Endpoint string

func (Endpoint) Path

func (e Endpoint) Path(prefix string) string

Path adds endpoint name to a service prefix. If prefix is empty, nothing is added. For example, EndpointAddLeaf.Path("example.com/sigsum") -> "example.com/sigsum/add-leaf". EndpointAddLeaf.Path("") -> "add-leaf".

type InclusionProof

type InclusionProof struct {
	Size      uint64
	LeafIndex uint64
	Path      []crypto.Hash
}

func (*InclusionProof) FromASCII

func (pr *InclusionProof) FromASCII(r io.Reader, size uint64) error

func (*InclusionProof) ToASCII

func (pr *InclusionProof) ToASCII(w io.Writer) error

Note the size is not included on the wire.

func (*InclusionProof) Verify

func (pr *InclusionProof) Verify(leaf *crypto.Hash, root *crypto.Hash) error

type Leaf

type Leaf struct {
	Checksum  crypto.Hash
	Signature crypto.Signature
	KeyHash   crypto.Hash
}

func LeavesFromASCII added in v0.1.6

func LeavesFromASCII(r io.Reader) ([]Leaf, error)

func (*Leaf) FromBinary

func (l *Leaf) FromBinary(b []byte) error

func (*Leaf) ToASCII

func (l *Leaf) ToASCII(w io.Writer) error

func (*Leaf) ToBinary

func (l *Leaf) ToBinary() []byte

func (*Leaf) Verify added in v0.1.3

func (l *Leaf) Verify(key *crypto.PublicKey) bool

type SignedTreeHead

type SignedTreeHead struct {
	TreeHead
	Signature crypto.Signature
}

func (*SignedTreeHead) FromASCII

func (sth *SignedTreeHead) FromASCII(r io.Reader) error

func (*SignedTreeHead) ToASCII

func (sth *SignedTreeHead) ToASCII(w io.Writer) error

func (*SignedTreeHead) Verify

func (sth *SignedTreeHead) Verify(key *crypto.PublicKey) bool

type TreeHead

type TreeHead struct {
	Size     uint64
	RootHash crypto.Hash
}

func (*TreeHead) Cosign added in v0.1.14

func (th *TreeHead) Cosign(signer crypto.Signer, logKeyHash *crypto.Hash, timestamp uint64) (Cosignature, error)

func (*TreeHead) FromASCII

func (th *TreeHead) FromASCII(r io.Reader) error

func (*TreeHead) Sign

func (th *TreeHead) Sign(signer crypto.Signer) (SignedTreeHead, error)

func (*TreeHead) ToASCII

func (th *TreeHead) ToASCII(w io.Writer) error

Jump to

Keyboard shortcuts

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