oven-sh/bun · error · TypeError

SUITE_B_INVALID_SIGNATURE_ALGORITHM

SUITE_B_INVALID_SIGNATURE_ALGORITHM

Error message

SUITE_B_INVALID_SIGNATURE_ALGORITHM

What it means

CertError::SUITE_B_INVALID_SIGNATURE_ALGORITHM maps BoringSSL X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM (verify code 59). Under Suite B, every signature in the chain must be ECDSA with SHA-256 or SHA-384 (matching the LOS); a certificate is signed with something else - RSA, RSA-SHA1, ECDSA-SHA512. Message: "Suite B: invalid signature algorithm".

Source

Thrown at src/http/error.rs:237

    #[error("SUBTREE_MINMAX")]
    SUBTREE_MINMAX,
    #[error("APPLICATION_VERIFICATION")]
    APPLICATION_VERIFICATION,
    #[error("UNSUPPORTED_CONSTRAINT_TYPE")]
    UNSUPPORTED_CONSTRAINT_TYPE,
    #[error("UNSUPPORTED_CONSTRAINT_SYNTAX")]
    UNSUPPORTED_CONSTRAINT_SYNTAX,
    #[error("UNSUPPORTED_NAME_SYNTAX")]
    UNSUPPORTED_NAME_SYNTAX,
    #[error("CRL_PATH_VALIDATION_ERROR")]
    CRL_PATH_VALIDATION_ERROR,
    #[error("SUITE_B_INVALID_VERSION")]
    SUITE_B_INVALID_VERSION,
    #[error("SUITE_B_INVALID_ALGORITHM")]
    SUITE_B_INVALID_ALGORITHM,
    #[error("SUITE_B_INVALID_CURVE")]
    SUITE_B_INVALID_CURVE,
    #[error("SUITE_B_INVALID_SIGNATURE_ALGORITHM")]
    SUITE_B_INVALID_SIGNATURE_ALGORITHM,
    #[error("SUITE_B_LOS_NOT_ALLOWED")]
    SUITE_B_LOS_NOT_ALLOWED,
    #[error("SUITE_B_CANNOT_SIGN_P_384_WITH_P_256")]
    SUITE_B_CANNOT_SIGN_P_384_WITH_P_256,
    #[error("HOSTNAME_MISMATCH")]
    HOSTNAME_MISMATCH,
    #[error("EMAIL_MISMATCH")]
    EMAIL_MISMATCH,
    #[error("IP_ADDRESS_MISMATCH")]
    IP_ADDRESS_MISMATCH,
    #[error("INVALID_CALL")]
    INVALID_CALL,
    #[error("STORE_LOOKUP")]
    STORE_LOOKUP,
    #[error("NAME_CONSTRAINTS_WITHOUT_SANS")]
    NAME_CONSTRAINTS_WITHOUT_SANS,
    #[error("UNKNOWN_CERTIFICATE_VERIFICATION_ERROR")]

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. List signature algorithms: openssl x509 -noout -text | grep 'Signature Algorithm' for every chain cert
  2. Re-sign with ecdsa-with-SHA256 (P-256) or ecdsa-with-SHA384 (P-384) - usually just reissuing from an ECDSA CA with correct defaults
  3. Remove any SHA-1-signed certificate from the chain; Suite B will never accept it
  4. If RSA must stay, disable Suite B flags on the verifier

Example fix

# before: EC key signed with the wrong digest
openssl x509 -req -in csr -CA ca.pem -md sha512 ...

# after: Suite B-consistent digest
openssl x509 -req -in csr -CA ca.pem -md sha384 ...
Defensive patterns

Strategy: validation

Validate before calling

// Assert all chain signatures are ecdsa-with-SHA256/384 before Suite B verification hits them
import tls from "node:tls";
import { X509Certificate } from "node:crypto";
export function chainSigsSuiteB(host, port = 443) {
  return new Promise((resolve, reject) => {
    const s = tls.connect({ host, port, servername: host, rejectUnauthorized: false }, () => {
      let c = s.getPeerCertificate(true), ok = true;
      do {
        const txt = new X509Certificate(c.raw).toString();
        ok = ok && /Signature Algorithm: ecdsa-with-(SHA256|SHA384)/.test(txt);
      } while (c.issuerCertificate && (c = c.issuerCertificate) && !Object.is(c, s.getPeerCertificate(true)));
      s.end(); resolve(ok);
    });
    s.on("error", reject);
  });
}

Type guard

export function isSuiteBInvalidSignatureAlgorithm(e): e is Error & { code: "SUITE_B_INVALID_SIGNATURE_ALGORITHM" } {
  return e instanceof Error && (e as any).code === "SUITE_B_INVALID_SIGNATURE_ALGORITHM";
}

Try / catch

try {
  await fetch(url);
} catch (e) {
  if (e?.code === "SUITE_B_INVALID_SIGNATURE_ALGORITHM") {
    // a chain signature isn't ecdsa-with-SHA256/384 - re-sign with the Suite B digest
    resignChainForSuiteB(url);
  } else throw e;
}

Prevention

When it happens

Trigger: Suite B verification with a chain containing an RSA-signed certificate or a signature hash outside {SHA-256, SHA-384} (e.g. SHA-1 intermediates or SHA-512 leafs).

Common situations: Chains where keys are ECDSA but signing requests specified RSA-SHA256 by mistake; old SHA-1 intermediates still trusted; signing tools defaulting to SHA-512 on P-384 keys.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/b6e710d780d241ae. Report an issue: GitHub.