util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 41

Documentation

Overview

Package util provides general utility functions for the CT personality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLogLeaf added in v1.0.18

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 BuildLogLeafWithChainHash added in v1.2.0

func BuildLogLeafWithChainHash(logPrefix string, merkleLeaf ct.MerkleTreeLeaf, leafIndex int64, cert ct.ASN1Cert, chainHash []byte, isPrecert bool) (*trillian.LogLeaf, error)

BuildLogLeafWithChainHash returns a Trillian LogLeaf structure for a (pre-)cert and the chain of certificates leading it up to a known root.

func ExtraDataForChain added in v1.0.18

func ExtraDataForChain(cert ct.ASN1Cert, chain []ct.ASN1Cert, isPrecert bool) ([]byte, error)

ExtraDataForChain creates the extra data associated with a log entry as described in RFC6962 section 4.6.

func ExtraDataForChainHash added in v1.2.0

func ExtraDataForChainHash(cert ct.ASN1Cert, chainHash []byte, isPrecert bool) ([]byte, error)

ExtraDataForChainHash creates the extra data associated with a log entry as described in RFC6962 section 4.6 except the chain being replaced with its hash.

Types

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.

Jump to

Keyboard shortcuts

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