package util
import "github.com/google/certificate-transparency-go/trillian/util"
Package util provides general utility functions for the CT personality.
Index ¶
- func BuildLogLeaf(logPrefix string, merkleLeaf ct.MerkleTreeLeaf, leafIndex int64, cert ct.ASN1Cert, chain []ct.ASN1Cert, isPrecert bool, ) (trillian.LogLeaf, error)
- func ExtraDataForChain(cert ct.ASN1Cert, chain []ct.ASN1Cert, isPrecert bool) ([]byte, error)
- type FixedBackendResolver
- type FixedTimeSource
- type SystemTimeSource
- type TimeSource
Functions ¶
func BuildLogLeaf ¶
func BuildLogLeaf(logPrefix string, merkleLeaf ct.MerkleTreeLeaf, leafIndex int64, cert ct.ASN1Cert, chain []ct.ASN1Cert, isPrecert bool, ) (trillian.LogLeaf, error)
BuildLogLeaf returns a Trillian LogLeaf structure for a (pre-)cert and the chain of certificates leading it up to a known root.
func ExtraDataForChain ¶
ExtraDataForChain creates the extra data associated with a log entry as described in RFC6962 section 4.6.
Types ¶
type FixedBackendResolver ¶
type FixedBackendResolver struct{}
FixedBackendResolver implements the naming.Resolver interface by just returning a fixedBackends object for the comma-separated names in the target.
func (FixedBackendResolver) Resolve ¶
func (f FixedBackendResolver) Resolve(target string) (naming.Watcher, error)
Resolve returns a fixedBackends object for the given target.
type FixedTimeSource ¶
type FixedTimeSource struct {
// contains filtered or unexported fields
}
FixedTimeSource provides a fixed time for use in tests. It should not be used in production code.
func NewFixedTimeSource ¶
func NewFixedTimeSource(t time.Time) *FixedTimeSource
NewFixedTimeSource creates a FixedTimeSource instance
func (*FixedTimeSource) Now ¶
func (f *FixedTimeSource) Now() time.Time
Now returns the time value this instance contains
type SystemTimeSource ¶
type SystemTimeSource struct{}
SystemTimeSource provides the current system local time
func (SystemTimeSource) Now ¶
func (s SystemTimeSource) Now() time.Time
Now returns the true current local time.
type TimeSource ¶
type TimeSource interface { // Now returns the current time in real implementations or a suitable value in others Now() time.Time }
TimeSource can provide the current time, or be replaced by a mock in tests to return specific values.
Source Files ¶
log_leaf.go resolver.go timesource.go
- Version
- v1.0.18
- Published
- May 22, 2018
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 1 hour ago –
Tools for package owners.