Skip to main content

Module der

Module der 

Source
Expand description

Just enough DER to fill in a certificate record’s attributes.

A keychain stores several fields of an X.509 certificate alongside the certificate itself: the subject and issuer names, the serial number, the subject key identifier, and a hash of the public key. Every one of them is a copy of bytes already in the certificate, so this module locates fields and hands back slices. It does not decode, validate, or re-encode anything, and it is not a general ASN.1 library — that boundary is what keeps it small enough to be obviously right.

Field positions come from RFC 5280:

Certificate      ::= SEQUENCE { tbsCertificate, signatureAlgorithm, signature }
TBSCertificate   ::= SEQUENCE { [0] version OPTIONAL, serialNumber, signature,
                                issuer, validity, subject,
                                subjectPublicKeyInfo, ... [3] extensions }

Modules§

tag
Universal and context tags this module names.

Structs§

Certificate
The parts of a certificate a keychain record stores.
PrivateKeyInfo
A PKCS#8 PrivateKeyInfo, enough of it to describe the key.
Tlv
A tag-length-value element, with its contents located inside the input.

Constants§

OID_EC_PUBLIC_KEY
id-ecPublicKey (1.2.840.10045.2.1).
OID_RSA_ENCRYPTION
rsaEncryption (1.2.840.113549.1.1.1).

Functions§

pem_or_der
Decode PEM if the input looks like it, otherwise pass DER through.
read
Read one element at at.