nish/crypto/x509

DER, PEM and the X.509 certificates a WebTransport or TLS server holds: read a P-256 private key and a certificate chain out of PEM, and mint the short-lived self-signed ECDSA P-256 certificate a browser pins by its SHA-256.

import {
  X509Certificate,
  X509GeneralSubtree,
  X509_GN_DIR,
  X509_GN_DNS,
  X509_GN_IP,
  X509_GN_OTHER,
  X509_HASH_SHA256,
  X509_HASH_SHA384,
  X509_HASH_SHA512,
  X509_KEY_ED25519,
  X509_KEY_P256,
  X509_KEY_P384,
  X509_KEY_RSA,
  X509_KEY_UNKNOWN,
  X509_KU_CRL_SIGN,
  X509_KU_DIGITAL_SIGNATURE,
  X509_KU_KEY_CERT_SIGN,
  X509_MAX_DAYS,
  X509_MAX_SERIAL,
  X509_SIG_ECDSA_SHA256,
  X509_SIG_ECDSA_SHA384,
  X509_SIG_ED25519,
  X509_SIG_RSA_PKCS1_SHA1,
  X509_SIG_RSA_PKCS1_SHA256,
  X509_SIG_RSA_PKCS1_SHA384,
  X509_SIG_RSA_PKCS1_SHA512,
  X509_SIG_RSA_PSS,
  X509_SIG_UNKNOWN,
  derToPem,
  pemToDer,
  x509CertificateHash,
  x509DerSignatureRS,
  x509DerSignatureRSWidth,
  x509MintSelfSigned,
  x509NameEqual,
  x509NameIsPrefix,
  x509ParseCertificate,
  x509ParseChain,
  x509ParseP256PrivateKey,
  x509VerifySignature,
} from "nish/crypto/x509";
import { Secret, wipe } from "nish:secret";
import { x509MintSelfSigned, x509CertificateHash, derToPem } from "nish/crypto/x509";
// Native only: a program that imports this does not compile for wasm32, which has no entropy.
import { x509DrawP256Key, x509DrawSerial } from "nish/crypto/x509-random";

// Both come from the kernel's CSPRNG; a predictable key or serial is the caller's bug.
// A wasm32 program is handed them instead, and passes them in as they are passed here.
const priv: Secret<u8[]> = x509DrawP256Key();
const der: u8[] | null = x509MintSelfSigned(priv, "localhost", toI64(Date.now()), 14, x509DrawSerial());
wipe(priv);
// x509CertificateHash(der) is what serverCertificateHashes names;
// derToPem(der, "CERTIFICATE") is the file a TLS stack loads.

Written for this module from ITU-T X.690 (DER), RFC 5280 (the certificate profile and its extensions), RFC 7468 (PEM's textual encoding), RFC 5915 and RFC 5208/5958 (the SEC1 and PKCS#8 private-key structures), RFC 5480 (the elliptic-curve key identifiers), RFC 5758 (ECDSA with SHA-2), RFC 4055 (RSA PKCS#1 v1.5 and RSASSA-PSS identifiers) and RFC 8410 (Ed25519).

DER is read strictly

X.690 §10 leaves one encoding per value, and a reader that accepts a second spelling gives a certificate two identities while its hash — which is what a browser pins — names only one. So a length must be definite and minimal (no 0x80, no long form below 128, no leading zero length octet), an INTEGER must be minimal in two's complement, a tag must fit in one octet, every element must end inside its parent, and a certificate must end where its outer SEQUENCE does.

Anything else answers null, never a panic. The reader takes the version, serial, algorithms, the issuer and subject Names (their RDNs checked, their bytes kept whole), validity, the subject public key and the signature, checks the order of what follows the key ([1], [2], [3]), and decodes the extensions a path validator needs: subjectAltName, basicConstraints, keyUsage, extKeyUsage, nameConstraints and the two key identifiers. A duplicate or malformed one refuses the certificate, and each one's critical flag is kept. An authorityInfoAccess is held to its syntax but not kept, and any other critical extension sets unknownCritical. It parses and does not validate: applying these to a chain is RFC 5280 §6 path validation, which nish/crypto/pki's pkiVerifyServer does. The mint writes two extensions of its own (below).

PEM is RFC 7468's strict grammar

PEM is RFC 7468's strict grammar, with standard base64 (+ and /, padded with =), not base64url: 64 characters a line and a shorter last one, a -----END label equal to its -----BEGIN, no headers (so an RFC 1421 encrypted key is refused), and canonical base64 whose unused low bits are zero. Text between blocks is ignored, as RFC 7468 §5.2 allows, and so are blocks with another label; a line may end in CRLF.

The minted certificate

The minted certificate is what the WebTransport specification's serverCertificateHashes accepts (W3C WebTransport, "custom certificate requirements"): X.509 v3, an ECDSA P-256 key signed with ecdsa-with-SHA256, and a validity period of at most fourteen days — notAfter - notBefore, which is what Chromium compares, so days is 1 to 14. Subject and issuer are the same single common name, as a UTF8String. It carries two extensions, both critical and both constant: basicConstraints with cA FALSE and keyUsage with digitalSignature alone.

The W3C text requires no extension, but Chromium does: the verifier behind serverCertificateHashes, quiche's WebTransportFingerprintProofVerifier, parses the certificate with CertificateView::ParseSingleCertificate before it compares the hash, and that answers null when [3] extensions is absent (quiche/quic/core/crypto/certificate_view.cc:395, at the quiche revision 62826931 Chromium 141 pins), so the handshake fails with CERTIFICATE_VERIFY_FAILED. It also holds every extension to SEQUENCE { OID, BOOLEAN OPTIONAL, OCTET STRING } (:413–:432) and reads subjectAltName only when one is present (:434), so no name is needed there.

The two chosen say what the certificate is, an end entity whose key only signs handshakes, so a verifier that does build a path need not fall back on its defaults; OpenSSL verifies it as its own trust anchor (tests/link/crypto_x509's header has the commands; X509-9 in docs/security/crypto-x509.md). The key, the serial and the time are parameters so the golden certificate is deterministic; a caller passes Date.now() and, for the key and the serial, bytes from crypto.getRandomValues. This module does not draw them itself, because a call to the operating system would stop it compiling for wasm32; nish/crypto/x509-random, which this module does not import, draws both for a native program (X509-6).

Constant time

A private key is the one secret that passes through here: it is base64-decoded from PEM, lifted out of its DER, and handed to nish/crypto/p256. Base64 is nish/crypto/base64url's base64StdPadDecode, which maps a character to its sextet by arithmetic on range masks and folds a bad character into one word read after the whole text, so neither a branch nor a table index depends on the key's bytes.

PEM's framing is found by comparing the start of each line with the fixed -----BEGIN and -----END , which no base64 character matches, so those comparisons end on a line's first byte whatever the key is. The DER reader branches on tags and lengths, which are the key's public framing, and copies its 32 octets with a fixed loop. Signing is p256SignSha256, and checking a key against the public key stored beside it compares public values. None of this is under the disassembly check; it is discipline.

The private key is a `Secret`

The private key is a Secret (nish:secret, docs/LANGUAGE.md "Secrets"). x509ParseP256PrivateKey answers one and x509MintSelfSigned takes one; the scalar is copied out of its DER once, into the Secret, and every block decoded from the PEM is wiped before the parse returns (X509-7, docs/security/crypto-x509.md). The PEM text is the caller's string, which nothing in the language can wipe.

Private names carry the x509 prefix because a std/ module's private functions share the importing program's flat symbol namespace (docs/wp26-stdlib.md §3e).

Functions

derToPem

der as a PEM block (RFC 7468 §2): -----BEGIN label-----, the base64 of the DER in lines of 64 characters, and -----END label-----, each line ending in a line feed.

const derToPem: (der: u8[], label: string) => string
deru8[]required

The bytes to encode; any length, empty included.

labelstringrequired

The text between BEGIN and the dashes, such as CERTIFICATE; written as given, unchecked.

returnsstring

The PEM text, ending in a line feed.

pemToDer

The DER of every PEM block in pem whose label is exactly label, in the order they appear, or null when there is none or any block is malformed: an unterminated block, an END whose label is not its BEGIN's, a line longer than 64 characters or a short line before the last, a header line, or base64 that is not canonical. Blocks with other labels must be as well formed, and are skipped; so is text outside the blocks, though an -----END line outside a block answers null. A line may end in CRLF.

const pemToDer: (
  pem: string,
  label: string,
) => u8[][] | null
pemstringrequired

The PEM text.

labelstringrequired

The label to collect, compared byte for byte.

returnsu8[][] | null

A fresh array holding each matching block's DER, freshly decoded, or null.

x509CertificateHash

The SHA-256 of a certificate's DER: the value WebTransport's serverCertificateHashes pins, and what openssl x509 -outform DER | sha256sum prints.

const x509CertificateHash: (der: u8[]) => u8[]
deru8[]required

The certificate's DER, whole.

returnsu8[]

The 32-byte digest, a fresh array.

x509DerSignatureRS

x509DerSignatureRSWidth for P-256: r || s, 32 octets each, the form nish/crypto/p256 takes.

const x509DerSignatureRS: (sig: u8[]) => u8[] | null
sigu8[]required

The DER signature, read and not kept.

returnsu8[] | null

A fresh 64-octet array, r then s, or null.

x509DerSignatureRSWidth

r || s, width octets each, out of an ECDSA-Sig-Value SEQUENCE { INTEGER r, INTEGER s } (RFC 5480 §2.2 by way of RFC 3279 §2.2.3), or null unless it is exactly one with both integers minimal, not negative and below 2^(8 * width), and width is 32 (P-256) or 48 (P-384). This is the form a TLS CertificateVerify or an X.509 signature carries; that each value is below the curve's order is the curve's check.

const x509DerSignatureRSWidth: (
  sig: u8[],
  width: i32,
) => u8[] | null
sigu8[]required

The DER signature, read and not kept.

widthi32required

The octets each of r and s is padded to: 32 for P-256, 48 for P-384.

returnsu8[] | null

A fresh array of 2 * width octets, r then s, or null.

x509MintSelfSigned

A self-signed X.509 v3 certificate, in DER, for the P-256 key priv: subject and issuer CN=commonName, valid from notBeforeMs (milliseconds since 1970, rounded down to the second) for exactly days days, serial number serial, carrying x509MintExtensions' basicConstraints and keyUsage, and signed with ecdsa-with-SHA256 — see the module comment for why Chromium needs an extension at all.

null when days is below 1 or above X509_MAX_DAYS, notBeforeMs is negative or the validity would end after 9999, commonName is empty, longer than 64 bytes, not UTF-8 or holds a NUL (it is written as a UTF8String), priv is not a P-256 private key, or serial — big-endian, leading zeros ignored — is zero or needs more than X509_MAX_SERIAL octets as a positive INTEGER (clear the top bit of 20 random bytes, or use fewer).

const x509MintSelfSigned: (
  priv: Secret<u8[]>,
  commonName: string,
  notBeforeMs: i64,
  days: i32,
  serial: u8[],
) => u8[] | null
privSecret<u8[]>required

The 32-byte P-256 private scalar, big-endian; read, and left for the caller to wipe.

commonNamestringrequired

The subject's and issuer's common name, 1 to 64 bytes of UTF-8 without a NUL.

notBeforeMsi64required

When validity starts, in milliseconds since 1970-01-01 UTC.

daysi32required

How long it is valid, 1 to X509_MAX_DAYS.

serialu8[]required

The serial number's octets, big-endian.

returnsu8[] | null

The certificate's DER, a fresh array, or null.

x509NameEqual

Whether two Names are the same: their DER, byte for byte. RFC 5280 §7.1's comparison — case folded and white space collapsed after a stringprep of each attribute — is not implemented (X509-12 in docs/security/crypto-x509.md), so two Names spelled differently that it would match answer false. That fails closed: a chain whose issuer and subject differ only so is not built.

const x509NameEqual: (a: u8[], b: u8[]) => boolean
au8[]required

One Name's DER, whole, as X509Certificate.issuer or subject holds it.

bu8[]required

The other Name's DER.

returnsboolean

Whether the two are byte for byte equal.

x509NameIsPrefix

Whether the Name base is a prefix of the Name name, both whole DER as X509Certificate.issuer and subject hold them: each of base's RDNs is name's RDN at the same place, byte for byte — how a directoryName constraint (RFC 5280 §4.2.1.10) is matched. An empty base is a prefix of every Name. false when either is not a Name.

const x509NameIsPrefix: (base: u8[], name: u8[]) => boolean
baseu8[]required

The constraint's Name, whole DER.

nameu8[]required

The Name tested against it, whole DER.

returnsboolean

Whether base is a prefix of name.

x509ParseCertificate

der read as one Certificate (RFC 5280 §4.1), or null unless it is exactly one in DER: SEQUENCE { tbsCertificate, signatureAlgorithm, signatureValue }, where tbsCertificate holds an explicit version of v2 or v3 or none (DER omits v1, the default), a minimal serial, an algorithm equal to the outer one byte for byte (§4.1.1.2), issuer and subject Names, a Validity of two valid times, a SubjectPublicKeyInfo whose key is whole octets, then only the optional [1] and [2] unique identifiers (v2 and v3) and [3] extensions (v3), in that order.

Issuer and subject must be sound Names. The signature algorithm is named in sigAlg (with pssHash and pssSaltLen for RSA-PSS) and the key in keyType; p256 and ecdsaSha256 say whether they are the ones x509VerifySignature checks.

Extensions are read: subjectAltName, basicConstraints, keyUsage, extKeyUsage, nameConstraints and the two key identifiers are decoded into their fields with their critical flags, and null is the answer when any of them, or an authorityInfoAccess, is malformed or any extension appears twice. A critical extension it does not decode sets unknownCritical, which RFC 5280 §4.2 obliges a validator to refuse.

A parser, not a validator. It checks that the bytes are one certificate and what its extensions say. It does not check the signature (x509VerifySignature does), that notBefore is not after notAfter or that either is near any clock, or what the extensions mean for a chain, which is a path validator's to apply: nish/crypto/pki's pkiVerifyServer.

const x509ParseCertificate: (
  der: u8[],
) => X509Certificate | null
deru8[]required

One certificate's DER, read and not kept.

returnsX509Certificate | null

A new certificate whose byte fields are copies of der's, or null.

x509ParseChain

Every CERTIFICATE block in pem, in the order they appear — for a server's chain file, leaf first as TLS sends it — or null when there is none, or when any block is not PEM pemToDer accepts or a certificate x509ParseCertificate accepts.

It reads a chain; it does not validate one. Nothing relates one certificate to the next: not the order, not that each is issued by the one after it (issuer against subject, or signature), not validity against a clock, nor what each one's basicConstraints, keyUsage and name constraints allow, nor a trust anchor. Nothing here does RFC 5280 §6's path validation, and a chain this answers is no evidence that anyone vouches for the leaf; nish/crypto/pki's pkiVerifyServer is what does.

const x509ParseChain: (
  pem: string,
) => X509Certificate[] | null
pemstringrequired

The PEM text, such as a server's chain file.

returnsX509Certificate[] | null

A fresh array of new certificates, or null.

x509ParseP256PrivateKey

The 32-byte P-256 private key in pem, as the Secret it is: one EC PRIVATE KEY block (SEC1, RFC 5915, which must name its curve) or one PRIVATE KEY block (unencrypted PKCS#8, RFC 5208 or RFC 5958), and not both. null for no such block or more than one, for any curve but P-256, for a scalar of 0 or n or more, for a stored public key that is not the key's own, and for anything malformed. An ENCRYPTED PRIVATE KEY is a different label, and answers null. Every block decoded from pem is wiped before this returns, whichever answer it gives; pem itself is the caller's string, which nothing can wipe (X509-7 in docs/security/crypto-x509.md).

const x509ParseP256PrivateKey: (
  pem: string,
) => Secret<u8[]> | null
pemstringrequired

The PEM text holding the key.

returnsSecret<u8[]> | null

The 32-byte scalar, big-endian, in a fresh Secret the caller wipes, or null.

x509VerifySignature

Whether cert's signature is a valid ecdsa-with-SHA256 signature of its TBS bytes under issuer's P-256 key — a self-signed certificate passes itself as both. false for any other algorithm or key, and for a signature that is not a DER ECDSA-Sig-Value. Only the signature: that cert.issuer is issuer.subject and that the times hold are fields the caller compares, and whether issuer may issue at all (bcCa, keyUsage) is a path validator's to decide, so a true here is not path validation.

const x509VerifySignature: (
  cert: X509Certificate,
  issuer: X509Certificate,
) => boolean
certX509Certificaterequired

The certificate whose signature is checked.

issuerX509Certificaterequired

The certificate whose key is meant to have made it; cert itself for a self-signed one.

returnsboolean

Whether the signature verifies.

Classes

X509Certificate

One certificate, as x509ParseCertificate and x509ParseChain read it. The byte fields are copies, so the certificate outlives the text it was read from. Times are milliseconds since 1970-01-01 UTC, as Date.now() counts.

class X509Certificate
Member
new X509Certificate() A certificate with every field empty, zero, false or null, and bcPathLen and keyUsage at -1 for absent; x509ParseCertificate fills one in.
akiCritical: boolean Whether the authorityKeyIdentifier is marked critical, which RFC 5280 §4.2.1.1 forbids.
akid: u8[] | null The authorityKeyIdentifier's keyIdentifier (RFC 5280 §4.2.1.1), or null.
akiIssuerSerial: boolean Whether the authorityKeyIdentifier carries authorityCertIssuer and authorityCertSerialNumber, which are read and not kept.
akiPresent: boolean Whether an authorityKeyIdentifier extension is present (RFC 5280 §4.2.1.1), with or without its keyIdentifier.
bcCa: boolean basicConstraints' cA flag.
bcCritical: boolean Whether basicConstraints is marked critical, which RFC 5280 §4.2.1.9 requires of a CA.
bcPathLen: i32 basicConstraints' pathLenConstraint, or -1 when it is absent (no limit) or the extension is.
bcPresent: boolean Whether a basicConstraints extension is present (RFC 5280 §4.2.1.9).
der: u8[] The whole certificate, as its SHA-256 is taken.
ecdsaSha256: boolean Whether the signature algorithm is ecdsa-with-SHA256 with its parameters absent (RFC 5758 §3.2).
ekuAny: boolean Whether extKeyUsage names anyExtendedKeyUsage.
ekuCritical: boolean Whether extKeyUsage is marked critical, which RFC 5280 §4.2.1.12 allows and the Web PKI does not.
ekuPresent: boolean Whether an extKeyUsage extension is present (RFC 5280 §4.2.1.12).
ekuServerAuth: boolean Whether extKeyUsage names id-kp-serverAuth.
issuer: u8[] The issuer Name's DER, whole, to compare with another certificate's subject.
keyType: i32 The subject key's algorithm, an X509_KEY_ constant.
keyUsage: i32 The keyUsage bits (RFC 5280 §4.2.1.3), bit 0 digitalSignature to bit 8 decipherOnly, or -1 when absent.
kuCritical: boolean Whether keyUsage is marked critical, as RFC 5280 §4.2.1.3 says it should be.
ncCritical: boolean Whether nameConstraints is marked critical, which RFC 5280 §4.2.1.10 requires.
ncExcluded: X509GeneralSubtree[] nameConstraints' excludedSubtrees, in order.
ncPermitted: X509GeneralSubtree[] nameConstraints' permittedSubtrees, in order.
ncPresent: boolean Whether a nameConstraints extension is present (RFC 5280 §4.2.1.10).
ncUnsupported: boolean Whether any subtree is X509_GN_OTHER or carries a minimum or maximum, which a validator must refuse or understand.
notAfter: i64 The last instant it is valid, inclusive.
notBefore: i64 The first instant the certificate is valid, inclusive (RFC 5280 §4.1.2.5).
p256: boolean Whether the key is id-ecPublicKey on prime256v1 (RFC 5480 §2.1.1), so publicKey is a P-256 point.
pcCritical: boolean Whether policyConstraints is marked critical, which RFC 5280 §4.2.1.11 requires.
pcPresent: boolean Whether a policyConstraints extension (RFC 5280 §4.2.1.11) is present. It is not decoded, so a critical one also sets unknownCritical.
pssHash: i32 For RSASSA-PSS, the hash of the message and of MGF1, an X509_HASH_ constant; else 0.
pssSaltLen: i32 For RSASSA-PSS, the salt length in octets; else 0.
publicKey: u8[] The subjectPublicKey BIT STRING's octets: for a P-256 key, the 65-byte uncompressed point.
sanCritical: boolean Whether subjectAltName is marked critical: RFC 5280 §4.2.1.6 has it critical when the subject is empty, and not otherwise.
sanDns: string[] subjectAltName's dNSNames, the IA5 bytes exactly as encoded, with no case folded.
sanIp: u8[][] subjectAltName's iPAddresses, 4 octets or 16 each.
sanOther: i32 How many of subjectAltName's names are another form: rfc822Name, URI, directoryName and the rest. Each must still be well formed: an rfc822Name or URI is an IA5String like a dNSName, so one with an octet of 0x80 or more, or a NUL, refuses the certificate rather than being counted.
sanPresent: boolean Whether a subjectAltName extension is present (RFC 5280 §4.2.1.6).
serial: u8[] The serial number's INTEGER contents, two's complement as encoded.
sigAlg: i32 The signature algorithm, an X509_SIG_ constant.
signature: u8[] The signatureValue BIT STRING's octets: for ECDSA, the DER SEQUENCE { r, s }.
skiCritical: boolean Whether the subjectKeyIdentifier is marked critical, which RFC 5280 §4.2.1.2 forbids.
skid: u8[] | null The subjectKeyIdentifier (RFC 5280 §4.2.1.2), or null.
spki: u8[] The subjectPublicKeyInfo's DER, whole: the key and its algorithm, as a key pin or nish/crypto/pki's pkiDistrustSpki hashes it.
subject: u8[] The subject Name's DER, whole.
tbs: u8[] The DER of tbsCertificate, the bytes the signature covers.
unknownCritical: boolean Whether a critical extension is one this module does not decode: RFC 5280 §4.2 has a verifier refuse it.
version: i32 The version as encoded: 0 for v1, 1 for v2, 2 for v3.

X509GeneralSubtree

One subtree of a nameConstraints extension (RFC 5280 §4.2.1.10): its base name's form in kind, and the value of the forms this module reads. A subtree whose minimum or maximum is present keeps its base here and sets the certificate's ncUnsupported.

class X509GeneralSubtree
Member
new X509GeneralSubtree() A subtree with no form and no name; x509ParseCertificate fills each one it reads.
dirName: u8[] For a directoryName, the Name's DER, whole.
dns: string For a dNSName, its IA5 bytes exactly as encoded, with no case folded; "" may be the whole tree.
ip: u8[] For an iPAddress, the address: 4 octets or 16.
kind: i32 X509_GN_DNS, X509_GN_IP, X509_GN_DIR or X509_GN_OTHER.
mask: u8[] For an iPAddress, the mask, as long as ip and contiguous.

Limits

14

X509_MAX_DAYS: i32

The longest validity x509MintSelfSigned writes, in days: WebTransport's two weeks.

Constants

3

X509_GN_DIR: i32

A directoryName, the Name's DER in dirName.

1

X509_GN_DNS: i32

X509GeneralSubtree.kind: a dNSName, in dns.

2

X509_GN_IP: i32

An iPAddress range, ip under mask.

4

X509_GN_OTHER: i32

Any other GeneralName form: rfc822Name, URI, otherName and the rest, which this module keeps no value for.

1

X509_HASH_SHA256: i32

X509Certificate.pssHash: SHA-256.

2

X509_HASH_SHA384: i32

SHA-384.

3

X509_HASH_SHA512: i32

SHA-512.

4

X509_KEY_ED25519: i32

id-Ed25519 with parameters absent (RFC 8410 §3).

1

X509_KEY_P256: i32

id-ecPublicKey on secp256r1 (RFC 5480 §2.1.1): the same test as p256.

2

X509_KEY_P384: i32

id-ecPublicKey on secp384r1 (RFC 5480 §2.1.1.1).

3

X509_KEY_RSA: i32

rsaEncryption with NULL parameters (RFC 3279 §2.3.1); publicKey is the RSAPublicKey DER.

0

X509_KEY_UNKNOWN: i32

X509Certificate.keyType: a key algorithm this module does not name.

64

X509_KU_CRL_SIGN: i32

cRLSign, bit 6.

1

X509_KU_DIGITAL_SIGNATURE: i32

X509Certificate.keyUsage bits (RFC 5280 §4.2.1.3): bit 0 is digitalSignature.

32

X509_KU_KEY_CERT_SIGN: i32

keyCertSign, bit 5.

20

X509_MAX_SERIAL: i32

Longest serial number, in content octets of its INTEGER (RFC 5280 §4.1.2.2).

1

X509_SIG_ECDSA_SHA256: i32

ecdsa-with-SHA256, parameters absent (RFC 5758 §3.2).

2

X509_SIG_ECDSA_SHA384: i32

ecdsa-with-SHA384, parameters absent (RFC 5758 §3.2).

7

X509_SIG_ED25519: i32

Ed25519, parameters absent (RFC 8410 §3).

8

X509_SIG_RSA_PKCS1_SHA1: i32

sha1WithRSAEncryption, parameters NULL: recognised so that a verifier can refuse it by name.

3

X509_SIG_RSA_PKCS1_SHA256: i32

sha256WithRSAEncryption, parameters NULL (RFC 4055 §5).

4

X509_SIG_RSA_PKCS1_SHA384: i32

sha384WithRSAEncryption, parameters NULL.

5

X509_SIG_RSA_PKCS1_SHA512: i32

sha512WithRSAEncryption, parameters NULL.

6

X509_SIG_RSA_PSS: i32

RSASSA-PSS (RFC 4055 §3.1) with a SHA-2 hash, MGF1 over that same hash and the trailer 1; the hash is in pssHash and the salt length in pssSaltLen.

0

X509_SIG_UNKNOWN: i32

X509Certificate.sigAlg: a signature algorithm this module does not name, or one with parameters it does not accept.