types

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: BSD-2-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EndpointAddLeaf             = Endpoint("add-leaf")
	EndpointAddCosignature      = Endpoint("add-cosignature")
	EndpointGetTreeHeadToCosign = Endpoint("get-tree-head-to-cosign")
	EndpointGetTreeHeadCosigned = Endpoint("get-tree-head-cosigned")
	EndpointGetInclusionProof   = Endpoint("get-inclusion-proof/")
	EndpointGetConsistencyProof = Endpoint("get-consistency-proof/")
	EndpointGetLeaves           = Endpoint("get-leaves/")

	EndpointGetTreeHeadUnsigned = Endpoint("get-tree-head-unsigned")
)
View Source
const (
	TreeHeadNamespace = "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
	Signature crypto.Signature
}

func (*Cosignature) ToASCII added in v0.1.6

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

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(components ...string) string

Path joins a number of components to form a full endpoint path. For example, EndpointAddLeaf.Path("example.com", "sigsum") -> example.com/sigsum/add-leaf.

type InclusionProof

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

func (*InclusionProof) FromASCII

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

func (*InclusionProof) ToASCII

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

Note the tree_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
	Timestamp uint64
	Signature crypto.Signature
}

func (*SignedTreeHead) FromASCII

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

func (*SignedTreeHead) Sign added in v0.1.9

func (sth *SignedTreeHead) Sign(signer crypto.Signer, kh *crypto.Hash) (crypto.Signature, error)

func (*SignedTreeHead) ToASCII

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

func (*SignedTreeHead) Verify

func (sth *SignedTreeHead) Verify(key *crypto.PublicKey, signature *crypto.Signature, logKeyHash *crypto.Hash) bool

func (*SignedTreeHead) VerifyLogSignature added in v0.1.9

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

type TreeHead

type TreeHead struct {
	TreeSize uint64
	RootHash crypto.Hash
}

func (*TreeHead) FromASCII

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

func (*TreeHead) Sign

func (th *TreeHead) Sign(signer crypto.Signer, kh *crypto.Hash, timestamp uint64) (*SignedTreeHead, error)

func (*TreeHead) ToASCII

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

func (*TreeHead) Verify added in v0.1.2

func (th *TreeHead) Verify(key *crypto.PublicKey, signature *crypto.Signature,
	kh *crypto.Hash, timestamp uint64) bool

Jump to

Keyboard shortcuts

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