package logid

import "github.com/google/certificate-transparency-go/logid"

Package logid provides a type and accompanying helpers for manipulating log IDs.

Index

Types

type LogID

type LogID [sha256.Size]byte

LogID is a unique identifier for a CT Log derived from its public key as described by RFC6962 sect. 3.2. Since it is derived from a SHA-256 hash, its length is fixed at 32 bytes.

func FromB64

func FromB64(logIDB64 string) (LogID, error)

FromB64 returns a LogID from parsing the supplied base64-encoded Log ID.

func FromB64OrDie

func FromB64OrDie(logIDB64 string) LogID

FromB64OrDie returns a LogID from parsing supplied base64-encoded data that we assert is already well-formed, so it 'cannot fail'.

func FromBytes

func FromBytes(bytes []byte) (LogID, error)

FromBytes returns a LogID copied from the supplied byte slice.

func FromPubKeyB64

func FromPubKeyB64(pubKeyB64 string) (LogID, error)

FromPubKeyB64 takes a base64 encoded DER public key, and converts it into a LogID, as defined in RFC6962 - i.e. the SHA-256 hash of the base64 decoded bytes of the log's public key.

func FromPubKeyB64OrDie

func FromPubKeyB64OrDie(pubKeyB64 string) LogID

FromPubKeyB64OrDie takes a base64 encoded DER public key, and converts it into a LogID, as defined in RFC6962 - i.e. the sha256 hash of the base64 decoded bytes of the log's public key. This is for data that we assert is already well-formed, so it 'cannot fail'.

func (LogID) Bytes

func (l LogID) Bytes() []byte

Bytes returns the raw bytes of the LogID, as a slice.

func (LogID) String

func (l LogID) String() string

String base64-encodes a LogID for ease of debugging.

Source Files

logid.go

Version
v1.3.1 (latest)
Published
Jan 15, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
4 days ago

Tools for package owners.