How to determine if a certificate is authorized
masterWhen writing a hook script to filter out legitimate certificates, avoid using fingerprints, serial numbers, Subject Key Identifiers (SKI), or Issuer fields, as these can be spoofed or vary between precertificates and certificates.
Instead, use one of these two methods:
Compare TBS Hash: Compare the
$TBS_SHA256value against a list of authorized TBS hashes. The TBS hash is computed over the DER encoding of theTBSCertificatewith any SCT extension removed. You can compute this usingcertspotter-authorize(8) -printhash.Compare Public Key Hash: Compare the
$PUBKEY_SHA256value against a list of authorized public key hashes. You can compute a public key hash manually using:
openssl x509 -pubkey -noout | openssl pkey -pubin -outform DER | openssl sha256