Documentation ¶
Index ¶
- Constants
- func Hash(buf []byte) *[HashSize]byte
- func HashLeaf(buf []byte) *[HashSize]byte
- type ConsistencyProof
- type ConsistencyProofRequest
- type CosignatureRequest
- type CosignedTreeHead
- type Endpoint
- type InclusionProof
- type InclusionProofRequest
- type Leaf
- type LeafList
- type LeafRequest
- type LeavesRequest
- type Message
- type MessageASCII
- func (msg *MessageASCII) GetHash(key string) (*[HashSize]byte, error)
- func (msg *MessageASCII) GetSignature(key string) (*[SignatureSize]byte, error)
- func (msg *MessageASCII) GetString(key string) (string, error)
- func (msg *MessageASCII) GetStrings(key string) []string
- func (msg *MessageASCII) GetUint64(key string) (uint64, error)
- func (msg *MessageASCII) GetVerificationKey(key string) (*[VerificationKeySize]byte, error)
- func (msg *MessageASCII) NumField() int
- type SigIdent
- type SignedTreeHead
- type TreeHead
Constants ¶
const ( // Delim is a key-value separator Delim = "=" // EOL is a line sepator EOL = "\n" // NumField* is the number of unique keys in an incoming ASCII message NumFieldLeaf = 4 NumFieldSignedTreeHead = 4 NumFieldConsistencyProof = 3 NumFieldInclusionProof = 3 NumFieldLeavesRequest = 2 NumFieldInclusionProofRequest = 2 NumFieldConsistencyProofRequest = 2 NumFieldLeafRequest = 5 NumFieldCosignatureRequest = 2 // New leaf keys ShardHint = "shard_hint" Checksum = "checksum" Signature = "signature" VerificationKey = "verification_key" DomainHint = "domain_hint" // Inclusion proof keys LeafHash = "leaf_hash" LeafIndex = "leaf_index" InclusionPath = "inclusion_path" // Consistency proof keys NewSize = "new_size" OldSize = "old_size" ConsistencyPath = "consistency_path" // Range of leaves keys StartSize = "start_size" EndSize = "end_size" // Tree head keys Timestamp = "timestamp" TreeSize = "tree_size" RootHash = "root_hash" // Witness signature-identity keys KeyHash = "key_hash" Cosignature = "cosignature" )
const ( // MessageSize is the number of bytes in a Trunnel-encoded leaf message MessageSize = 8 + HashSize // LeafSize is the number of bytes in a Trunnel-encoded leaf LeafSize = MessageSize + SignatureSize + HashSize // TreeHeadSize is the number of bytes in a Trunnel-encoded tree head TreeHeadSize = 8 + 8 + HashSize + HashSize )
const ( HashSize = sha256.Size SignatureSize = ed25519.SignatureSize VerificationKeySize = ed25519.PublicKeySize EndpointAddLeaf = Endpoint("add-leaf") EndpointAddCosignature = Endpoint("add-cosignature") EndpointGetTreeHeadLatest = Endpoint("get-tree-head-latest") EndpointGetTreeHeadToSign = Endpoint("get-tree-head-to-sign") EndpointGetTreeHeadCosigned = Endpoint("get-tree-head-cosigned") EndpointGetInclusionProof = Endpoint("get-inclusion-proof") EndpointGetConsistencyProof = Endpoint("get-consistency-proof") EndpointGetLeaves = Endpoint("get-leaves") )
const (
LeafHashPrefix = 0x00
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsistencyProof ¶
func (*ConsistencyProof) MarshalASCII ¶
func (p *ConsistencyProof) MarshalASCII(w io.Writer) error
func (*ConsistencyProof) UnmarshalASCII ¶
func (p *ConsistencyProof) UnmarshalASCII(r io.Reader) error
func (*ConsistencyProof) Verify ¶
func (p *ConsistencyProof) Verify(oldTH, newTH *TreeHead) error
Verify checks if two tree heads are consistent
type ConsistencyProofRequest ¶
func (*ConsistencyProofRequest) UnmarshalASCII ¶
func (req *ConsistencyProofRequest) UnmarshalASCII(r io.Reader) error
type CosignatureRequest ¶
type CosignatureRequest struct {
SigIdent
}
func (*CosignatureRequest) UnmarshalASCII ¶
func (req *CosignatureRequest) UnmarshalASCII(r io.Reader) error
type CosignedTreeHead ¶
type CosignedTreeHead struct { SignedTreeHead SigIdent []*SigIdent }
func (*CosignedTreeHead) MarshalASCII ¶
func (cth *CosignedTreeHead) MarshalASCII(w io.Writer) error
type InclusionProof ¶
func (*InclusionProof) MarshalASCII ¶
func (p *InclusionProof) MarshalASCII(w io.Writer) error
func (*InclusionProof) UnmarshalASCII ¶
func (p *InclusionProof) UnmarshalASCII(r io.Reader) error
func (*InclusionProof) Verify ¶
func (p *InclusionProof) Verify(leaf *Leaf, th *TreeHead) error
Verify checks if a leaf is included in the log
type InclusionProofRequest ¶
func (*InclusionProofRequest) UnmarshalASCII ¶
func (req *InclusionProofRequest) UnmarshalASCII(r io.Reader) error
type Leaf ¶
func (*Leaf) MarshalASCII ¶
* * MarshalASCII wrappers for types that the log server outputs *
type LeafRequest ¶
type LeafRequest struct { Message Signature *[SignatureSize]byte VerificationKey *[VerificationKeySize]byte DomainHint string }
func (*LeafRequest) UnmarshalASCII ¶
func (req *LeafRequest) UnmarshalASCII(r io.Reader) error
type LeavesRequest ¶
func (*LeavesRequest) UnmarshalASCII ¶
func (req *LeavesRequest) UnmarshalASCII(r io.Reader) error
type Message ¶
type MessageASCII ¶
type MessageASCII struct {
// contains filtered or unexported fields
}
MessageASCI is a wrapper that manages ASCII key-value pairs
func NewMessageASCII ¶
func NewMessageASCII(r io.Reader, numFieldExpected int) (*MessageASCII, error)
NewMessageASCII unpacks an incoming ASCII message
func (*MessageASCII) GetHash ¶
func (msg *MessageASCII) GetHash(key string) (*[HashSize]byte, error)
GetHash unpacks a hash
func (*MessageASCII) GetSignature ¶
func (msg *MessageASCII) GetSignature(key string) (*[SignatureSize]byte, error)
GetSignature unpacks a signature
func (*MessageASCII) GetString ¶
func (msg *MessageASCII) GetString(key string) (string, error)
GetString unpacks a string
func (*MessageASCII) GetStrings ¶
func (msg *MessageASCII) GetStrings(key string) []string
GetStrings returns a list of strings
func (*MessageASCII) GetUint64 ¶
func (msg *MessageASCII) GetUint64(key string) (uint64, error)
GetUint64 unpacks an uint64
func (*MessageASCII) GetVerificationKey ¶
func (msg *MessageASCII) GetVerificationKey(key string) (*[VerificationKeySize]byte, error)
GetVerificationKey unpacks a verification key
func (*MessageASCII) NumField ¶
func (msg *MessageASCII) NumField() int
NumField returns the number of unique keys
type SigIdent ¶
type SigIdent struct { Signature *[SignatureSize]byte KeyHash *[HashSize]byte }
type SignedTreeHead ¶
type SignedTreeHead struct { TreeHead Signature *[SignatureSize]byte }
func (*SignedTreeHead) MarshalASCII ¶
func (sth *SignedTreeHead) MarshalASCII(w io.Writer) error
func (*SignedTreeHead) UnmarshalASCII ¶
func (sth *SignedTreeHead) UnmarshalASCII(r io.Reader) error
type TreeHead ¶
type TreeHead struct { Timestamp uint64 TreeSize uint64 RootHash *[HashSize]byte KeyHash *[HashSize]byte }
func (*TreeHead) Marshal ¶
Marshal returns a Trunnel-encoded tree head
func (*TreeHead) Sign ¶
func (th *TreeHead) Sign(signer crypto.Signer) (*SignedTreeHead, error)
Sign signs the tree head using the log's signature scheme
func (*TreeHead) Verify ¶
func (th *TreeHead) Verify(vk *[VerificationKeySize]byte, sig *[SignatureSize]byte) error
Verify verifies the tree head signature using the log's signature scheme