package client

import "github.com/zmap/zcrypto/ct/client"

Package client is a CT log client implementation and contains types and code for interacting with RFC6962-compliant CT Log instances. See http://tools.ietf.org/html/rfc6962 for details

Index

Constants

const (
	AddChainPath    = "/ct/v1/add-chain"
	AddPreChainPath = "/ct/v1/add-pre-chain"
	AddJSONPath     = "/ct/v1/add-json"
	GetSTHPath      = "/ct/v1/get-sth"
	GetEntriesPath  = "/ct/v1/get-entries"
)

URI paths for CT Log endpoints

Types

type LogClient

type LogClient struct {
	Uri string // the base URI of the log. e.g. http://ct.googleapis/pilot
	// contains filtered or unexported fields
}

LogClient represents a client for a given CT Log instance

func New

func New(uri string) *LogClient

New constructs a new LogClient instance. |uri| is the base URI of the CT log instance to interact with, e.g. http://ct.googleapis.com/pilot

func (*LogClient) AddChain

func (c *LogClient) AddChain(chain []ct.ASN1Cert) (*ct.SignedCertificateTimestamp, error, int)

AddChain adds the (DER represented) X509 |chain| to the log.

func (*LogClient) AddChainWithContext

func (c *LogClient) AddChainWithContext(ctx context.Context, chain []ct.ASN1Cert) (*ct.SignedCertificateTimestamp, error, int)

AddChainWithContext adds the (DER represented) X509 |chain| to the log and fails if the provided context expires before the chain is submitted.

func (*LogClient) AddJSON

func (c *LogClient) AddJSON(data interface{}) (*ct.SignedCertificateTimestamp, error)

func (*LogClient) AddPreChain

func (c *LogClient) AddPreChain(chain []ct.ASN1Cert) (*ct.SignedCertificateTimestamp, error, int)

AddPreChain adds the (DER represented) Precertificate |chain| to the log.

func (*LogClient) GetEntries

func (c *LogClient) GetEntries(start, end int64) ([]ct.LogEntry, error)

GetEntries attempts to retrieve the entries in the sequence [|start|, |end|] from the CT log server. (see section 4.6.) Returns a slice of LeafInputs or a non-nil error.

func (*LogClient) GetSTH

func (c *LogClient) GetSTH() (sth *ct.SignedTreeHead, err error)

GetSTH retrieves the current STH from the log. Returns a populated SignedTreeHead, or a non-nil error.

Source Files

logclient.go

Directories

PathSynopsis
ct/client/main
Version
v0.0.0-20250324021606-4f0ea0eaccac (latest)
Published
Mar 24, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
1 month ago

Tools for package owners.