certdata

package
v0.0.0-...-ea10e50 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URL = "https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt"

	StartCertificate = "CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE" // Declaration of start of Certificate object.
	StartTrust       = "CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST"   // Declaration of start of a Distrust object.

	WebDistrust = "CKA_TRUST_SERVER_AUTH CK_TRUST (CKT_NSS_MUST_VERIFY_TRUST|CKT_NSS_NOT_TRUSTED)"
	WebTrust    = "CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR"

	EmailDistrust = "CKA_TRUST_EMAIL_PROTECTION CK_TRUST (CKT_NSS_MUST_VERIFY_TRUST|CKT_NSS_NOT_TRUSTED)"
	EmailTrust    = "CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR"

	IssuerPrefix       = "CKA_ISSUER MULTILINE_OCTAL"        // Declaration of start of a CKA_ISSUER block
	SerialNumberPrefix = "CKA_SERIAL_NUMBER MULTILINE_OCTAL" // Declaration of start of a CKA_SERIAL_NUMBER block.
	PEMPrefix          = "CKA_VALUE MULTILINE_OCTAL"         // Declaration of start a CKA_VALUE (PEM) block.
)

Strings that mark the beginning of blocks of text important for parsing certdata.txt.

Variables

This section is empty.

Functions

func DecodeDER

func DecodeDER(octal string) (string, string, error)

DecodeDER takes a DER encoded octal string and returns the base64 encoded certificate as well as its SHA-256 hash. No newlines, BEGIN, or END fields are present on the decoded string.

func DecodeIssuer

func DecodeIssuer(octal string) (pkix.RDNSequence, error)

DecodeIssuer parses the CKA_ISSUER MULTILINE_OCTAL field of certdata.txt.

func DecodeSerialNumber

func DecodeSerialNumber(octal string) (string, error)

DecodeSerialNumber takes a DER encoded octal string and returns the base64 encoded serial number.

func Extract

func Extract(b *bufio.Reader, start int, distrust bool, fname string) (*utils.Entry, int, error)

Extract extracts the entity from the bufio.Reader, 'b', that starts line number 'start'. 'distrust' is whether or not the entity is a distrust object. This is necessary since distrust objects do not have a PEM to parse out.

func ExtractMultilineOctal

func ExtractMultilineOctal(b *bufio.Reader) (string, int)

ExtractMultilineOctal consumes the provided bufio.Reader and returns a string of '\' delimited octal values and then number of lines consumed to extract the octal value.

func FmtFingerprint

func FmtFingerprint(h string) string

FmtFingerprint formats a SHA 256 hash with colons.

func NewEntry

func NewEntry(i pkix.RDNSequence, s string, pem string, hash string, webTrust, emailTrust bool, ln int, fname string) *utils.Entry

NewEntry constructs a new utils.Entry from the parsed ASN.1 issuer field, the serial number as a hex a string, the PEM as a base64 encoded string, the line number where entry started on, and the absolute path to the file where the entity was extracted from.

func ParseToNormalizedForm

func ParseToNormalizedForm(f io.Reader) ([]*utils.Entry, error)

ParseToNormalizedForm parses the provided certdata.txt into a normalized form that can be use to easily compare against a CCADB report.

Types

This section is empty.

Jump to

Keyboard shortcuts

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