oven-sh/bun · error · TypeError
SUITE_B_INVALID_ALGORITHM
SUITE_B_INVALID_ALGORITHM
Error message
SUITE_B_INVALID_ALGORITHM
What it means
CertError::SUITE_B_INVALID_ALGORITHM maps BoringSSL X509_V_ERR_SUITE_B_INVALID_ALGORITHM (verify code 57). Suite B verification requires ECDSA public keys throughout the chain; a certificate in the chain uses another algorithm (RSA, DSA, Ed25519). Message: "Suite B: invalid public key algorithm".
Source
Thrown at src/http/error.rs:233
#[error("PERMITTED_VIOLATION")]
PERMITTED_VIOLATION,
#[error("EXCLUDED_VIOLATION")]
EXCLUDED_VIOLATION,
#[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")]View on GitHub (pinned to 8c5296ac45)
Solutions
- Find the offending cert: openssl x509 -noout -text | grep 'Public Key Algorithm' across the chain
- Reissue every chain certificate with ECDSA keys (P-256 or P-384)
- Or disable Suite B flags on the verifying stack if the profile is not mandated
Example fix
# before openssl req -x509 -newkey rsa:2048 ... # after: ECDSA per Suite B openssl ecparam -name prime256v1 -genkey -out key.pem openssl req -x509 -key key.pem ...
Defensive patterns
Strategy: validation
Validate before calling
// Assert all chain certs use ECDSA when a Suite B verifier will connect
import tls from "node:tls";
import { X509Certificate } from "node:crypto";
export function chainIsAllEcdsa(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 { ok = ok && new X509Certificate(c.raw).keyObject.asymmetricKeyType === "ec"; } while (c.issuerCertificate && (c = c.issuerCertificate) && !Object.is(c, s.getPeerCertificate(true)));
s.end(); resolve(ok);
});
s.on("error", reject);
});
} Type guard
export function isSuiteBInvalidAlgorithm(e): e is Error & { code: "SUITE_B_INVALID_ALGORITHM" } {
return e instanceof Error && (e as any).code === "SUITE_B_INVALID_ALGORITHM";
} Try / catch
try {
await fetch(url);
} catch (e) {
if (e?.code === "SUITE_B_INVALID_ALGORITHM") {
// an RSA (or other non-ECDSA) cert is in the chain under Suite B - reissue with ECDSA
planReissueToEcdsa(new URL(url).hostname);
} else throw e;
} Prevention
- Finish ECDSA migrations end-to-end: root, intermediates, leaf - partial migration fails Suite B
- Set ECDSA as the default key type in your CA issuance pipeline if Suite B clients exist
- Grep public-key algorithms across the served chain monthly: openssl s_client -showcerts | grep 'Public Key Algorithm'
When it happens
Trigger: Suite B flags enabled on the verifier and any chain certificate carries an RSA key - typically a legacy RSA intermediate or leaf in front of an ECDSA-rooted hierarchy.
Common situations: Mixed-algorithm chains during incremental ECDSA migration; Suite B gateways in defense networks; default RSA certs (many CAs' default issuance) hitting a Suite B-verifying endpoint.
Related errors
- SUITE_B_INVALID_VERSION
- SUITE_B_INVALID_CURVE
- SUITE_B_INVALID_SIGNATURE_ALGORITHM
- SUITE_B_CANNOT_SIGN_P_384_WITH_P_256
- NO_EXPLICIT_POLICY
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/29e065787fe2fc21.
Report an issue: GitHub.