certdataDiffCCADB

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BEGIN = "-----BEGIN CERTIFICATE-----\n"
	END   = "-----END CERTIFICATE-----"
	WIDTH = 64 // Columns per line https://tools.ietf.org/html/rfc1421
)

Certificate normalization constants.

Variables

This section is empty.

Functions

func MapPairs

func MapPairs(cd, ccadb []*Entry) (pairs []Pair, unmatchedT []*Entry, unmatchedUT []*Entry)

MapPairs map all of the entries in certdata.txt to entries in the CCADB report. Entries are matched together if they:

  1. Have the same serial number (normalized for leading zeroes) or
  2. They have the exact same PEM. or
  3. They have the exact same Common Name.

Any entries for which a mapping could not be made are returned in the 'rest' slice.

func NormalizePEM

func NormalizePEM(pem string) string

normalizePEM ignores any formatting or string artifacts that the PEM may have had and applies https://tools.ietf.org/html/rfc1421

This stemmed from noticing that CCADB reports were fully formed while certdata PEMS had no formatting nor BEGIN/END fields. This is simply avoiding any surprises in individual formatting choices by forcing both to strip all formatting and conform to the one, chosen, way.

Types

type Entry

type Entry struct {
	OrganizationName       string `json:"organizationName"`
	OrganizationalUnitName string `json:"organizationalUnitName"`
	CommonName             string `json:"commonName"`
	SerialNumber           string `json:"serialNumber"`
	PEM                    string `json:"-"`
	Fingerprint            string `json:"sha256"`
	TrustWeb               bool   `json:"trustWeb"`
	TrustEmail             bool   `json:"trustEmail"`
	LineNumber             int    `json:"lineNumber"`
	Origin                 string `json:"origin"`
}

Entry is a normalized form of a Certificate Authority found in either certdata.txt or from a CCADB report CSV.

func NewEntry

func NewEntry(org, orgUnit, commonName, serial, pem, fingerprint string, trustWeb, trustEmail bool, line int, origin string) *Entry

NewEntry constructs a new Entry with a normalized PEM.

func (*Entry) DistinguishedName

func (e *Entry) DistinguishedName() string

DistinguishedName builds a hierarchical string of Organization, Orgizational Unit, and Common Name.

func (*Entry) NormalizedSerial

func (e *Entry) NormalizedSerial() string

NormalizedSerial returns the serial number with any leading zeroes stripped off.

func (*Entry) UniqueID

func (e *Entry) UniqueID() string

UniqueID returns the issuer distinguished name and the serial (noralized with no leading zeroes) contatenated together.

type Pair

type Pair struct {
	Certdata *Entry
	CCADB    *Entry
	Diffs    []string
}

Pair holds a normalized certdata.txt entry, it's sister CCADB, as well a slice of what fields between the two are differnt.

func NewPair

func NewPair(cd, ccadb *Entry) (p Pair)

NewPair discovers the difference between a matched certdata.txt entry and a CCADB report entry and constructs a new Pair.

Jump to

Keyboard shortcuts

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