certificatetransparency

package
v1.9.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const TileSize = 256

Variables

This section is empty.

Functions

func ConvertTileLeafToRawLogEntry

func ConvertTileLeafToRawLogEntry(leaf TileLeaf, index uint64) *ct.RawLogEntry

ConvertTileLeafToRawLogEntry converts a TileLeaf to ct.RawLogEntry for compatibility

func EncodeTilePath

func EncodeTilePath(index uint64) string

EncodeTilePath encodes a tile index into the proper path format

func GetLogOperators

func GetLogOperators() map[string][]string

func GetProcessedCerts

func GetProcessedCerts() int64

GetProcessedCerts returns the total number of processed certificates.

func GetProcessedPrecerts

func GetProcessedPrecerts() int64

GetProcessedPrecerts returns the total number of processed precertificates.

func ParseCertstreamEntry added in v1.8.0

func ParseCertstreamEntry(rawEntry *ct.RawLogEntry, operatorName, logname, ctURL string) (models.Entry, error)

ParseCertstreamEntry creates an Entry from a ct.RawLogEntry.

Types

type CTCertIndex

type CTCertIndex map[string]uint64

CTCertIndex is a map of CT log urls to the last processed certficate index on the said log.

type CTMetrics

type CTMetrics map[string]OperatorMetric

CTMetrics is a map of operator names to a map of CT log urls to the number of certs processed by said log.

func GetCertMetrics

func GetCertMetrics() CTMetrics

type LogMetrics

type LogMetrics struct {
	// contains filtered or unexported fields
}

LogMetrics is a struct that holds a map of metrics for each CT log grouped by operator. Metrics can be accessed and written concurrently through the Get, Set and Inc methods.

func (*LogMetrics) Get

func (m *LogMetrics) Get(operator, url string) int64

Get the metric for a given operator and ct url.

func (*LogMetrics) GetAllCTIndexes

func (m *LogMetrics) GetAllCTIndexes() CTCertIndex

GetAllCTIndexes returns a copy of the internal CT index map.

func (*LogMetrics) GetCTIndex

func (m *LogMetrics) GetCTIndex(url string) uint64

GetCTIndex returns the last cert index processed for a given CT url.

func (*LogMetrics) GetCTMetrics

func (m *LogMetrics) GetCTMetrics() CTMetrics

GetCTMetrics returns a copy of the internal metrics map.

func (*LogMetrics) Inc

func (m *LogMetrics) Inc(operator, url string, index uint64)

Inc the metric for a given operator and ct url.

func (*LogMetrics) Init added in v1.7.0

func (m *LogMetrics) Init(operator, url string)

Init initializes the internal metrics map with the given operator names and CT log urls if it doesn't exist yet.

func (*LogMetrics) LoadCTIndex

func (m *LogMetrics) LoadCTIndex(ctIndexFilePath string)

LoadCTIndex loads the last cert index processed for each CT url if it exists.

func (*LogMetrics) OperatorLogMapping

func (m *LogMetrics) OperatorLogMapping() OperatorLogs

OperatorLogMapping returns a map of operator names to a list of CT logs.

func (*LogMetrics) SaveCertIndexes

func (m *LogMetrics) SaveCertIndexes(ctIndexFilePath string)

SaveCertIndexes saves the index of CTLogs to a file.

func (*LogMetrics) SaveCertIndexesAtInterval

func (m *LogMetrics) SaveCertIndexesAtInterval(interval time.Duration, ctIndexFilePath string)

SaveCertIndexesAtInterval saves the index of CTLogs at given intervals. We first create a temp file and write the index data to it. Only then do we move the temp file to the actual permanent index file. This prevents the last good index file from being clobbered if the program was shutdown/killed in-between the write operation.

func (*LogMetrics) Set

func (m *LogMetrics) Set(operator, url string, value int64)

Set the metric for a given operator and ct url.

func (*LogMetrics) SetCTIndex

func (m *LogMetrics) SetCTIndex(url string, index uint64)

SetCTIndex sets the index for a given CT url.

type OperatorLogs

type OperatorLogs map[string][]string

OperatorLogs is a map of operator names to a list of CT log urls, operated by said operator.

type OperatorMetric

type OperatorMetric map[string]int64

OperatorMetric is a map of CT log urls to the number of certs processed by said log.

type TileLeaf

type TileLeaf struct {
	Timestamp     uint64
	EntryType     uint16
	X509Entry     []byte // For X.509 certificates
	PrecertEntry  []byte // For precertificates
	Chain         [][]byte
	IssuerKeyHash [32]byte
}

TileLeaf represents a single entry in a tile

func FetchTile

func FetchTile(ctx context.Context, client *http.Client, baseURL string, tileIndex uint64, partialWidth uint64) ([]TileLeaf, error)

FetchTile fetches a tile from the tiled CT log using the provided client. If partialWidth > 0, fetches a partial tile with that width (1-255).

func ParseTileData

func ParseTileData(data []byte) ([]TileLeaf, error)

ParseTileData parses the binary tile data into TileLeaf entries using cryptobyte

type TiledCheckpoint

type TiledCheckpoint struct {
	Origin string
	Size   uint64
	Hash   string
}

TiledCheckpoint represents the checkpoint information from a tiled CT log

func FetchCheckpoint

func FetchCheckpoint(ctx context.Context, client *http.Client, baseURL string) (*TiledCheckpoint, error)

FetchCheckpoint fetches the checkpoint from a tiled CT log using the provided client

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher describes a component that watches for new certificates in a CT log.

func NewWatcher added in v1.5.0

func NewWatcher(certChan chan models.Entry) *Watcher

NewWatcher creates a new Watcher.

func (*Watcher) CreateIndexFile

func (w *Watcher) CreateIndexFile(filePath string) error

CreateIndexFile creates a ct_index.json file based on the current STHs of all availble logs.

func (*Watcher) Start

func (w *Watcher) Start()

Start starts the watcher. This method is blocking.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop stops the watcher.

Jump to

Keyboard shortcuts

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