onecrl

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparison

type Comparison struct {
	OneCRL string
	CCADB  string
}

A Comparison holds the same piece of information in the preferred representation of OneCRL and CCADB. The purpose is to facilitate quick left/right comparisons between the datasets.

E.G. OneCRL encodes a serial number as a base64 however the CCADB encodes it as an uppercase hexadecimal.

type Details

type Details struct {
	Bug     string `json:"bug"`
	Who     string `json:"who"`
	Why     string `json:"why"`
	Name    string `json:"name"`
	Created string `json:"created"`
}

type IssuerSerialComparison

type IssuerSerialComparison struct {
	Issuer Comparison `json:"issuer"`
	Serial Comparison `json:"serial"`
}

type OneCRL

type OneCRL struct {
	*collections.Collection `json:"-"`
	Data                    []*Record `json:"data"`
}

func NewOneCRL

func NewOneCRL() *OneCRL

type Record

type Record struct {
	// It is rather awkward to hold onto a pointer to the associated CCADB entry,
	// however it makes constructing a Comparison struct much easier in main
	// as you can bundle the two together as soon has you find the match.
	// However, this could be a good opportunity for refactoring/decoupling.
	CCADB        *ccadb.Certificate `json:"-"`
	Schema       int                `json:"schema"`
	Details      Details            `json:"details"`
	Enabled      bool               `json:"enabled"`
	IssuerName   string             `json:"issuerName,omitempty"`
	SerialNumber string             `json:"serialNumber,omitempty"`
	Subject      string             `json:"subject,omitempty"`
	PubKeyHash   string             `json:"pubKeyHash,omitempty"`
	*api.Record
}

func FromCCADB

func FromCCADB(c *ccadb.Certificate) (*Record, error)

FromCCADB constructs a new OneCRL Record from the provided CCADB certificate.

The outcome of this procedure ultimately is what becomes the proposed changed to OneCRL.

func (*Record) IssuerSerial

func (r *Record) IssuerSerial() *set.IssuerSerial

IssuerSerial parses the X.509 certificate retrieved from the CCADB, extracts the issuer (https://tools.ietf.org/html/rfc5280#section-4.1.2.4) and serial number (https://tools.ietf.org/html/rfc5280#section-4.1.2.2)

An error will be logged and a nil IssuerSerial will be returned if the issuer field could not be parsed or the serial number could not be b64 decoded.

func (*Record) SubjectKeyHash

func (r *Record) SubjectKeyHash() *set.SubjectKeyHash

SubjectKeyHash parses the subject (https://tools.ietf.org/html/rfc5280#section-4.1.2.6) field of a OneCRL entry.

An error will be logged and a nil SubjectKeyHash will be returned if the subject field could not be parsed or the public key hash could not be b64 decoded.

func (*Record) ToComparison

func (r *Record) ToComparison() (interface{}, error)

ToComparison generates a comparison between OneCRL and CCADB that easy for a human to read in a left/right sort of way.

Example object may be:

{
	"issuer": {
		"OneCRL": "MFAxJDAiBgNVBAsTG0dsb2JhbFNpZ24gRUNDIFJvb3QgQ0EgLSBSNTETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbg==",
		"CCADB": "GlobalSign"
	},
	"serial": {
		"OneCRL": "Ae5fInnr9AhpWVIjkw==",
		"CCADB": "01EE5F2279EBF4086959522393"
	}
}

func (*Record) Type

func (r *Record) Type() set.Type

type Set

type Set struct {
	*set.SetImpl
}

A Set is a facade that splits OneCRL into two maps - one for lookups into the entries that are identified by the issuer:serial combination, and one for lookups into the entries that are identified by the subject:keyhash combination.

Asking if a CCADB entry is within this type is effectively asking whether it is in at least of the aforementioned maps.

func NewSet

func NewSet() *Set

func NewSetFrom

func NewSetFrom(records *OneCRL) *Set

func (*Set) Add

func (s *Set) Add(record set.Record)

func (*Set) Get

func (s *Set) Get(record set.Record) *Record

type SubjectKeyHashComparison

type SubjectKeyHashComparison struct {
	Subject Comparison `json:"subject"`
	Keyhash Comparison `json:"keyHash"`
}

Jump to

Keyboard shortcuts

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