{"record":{"id":"b505c3a386c64ef6","repo":"eclipse-vertx/vert.x","slug":"certificate-getsigalgname","errorCode":null,"errorMessage":"${certificate.getSigAlgName()}","messagePattern":"\\$\\{certificate\\.getSigAlgName\\(\\)\\}","errorType":"exception","errorClass":"NoSuchAlgorithmException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/internal/digest/SigningAlgorithm.java","lineNumber":69,"sourceCode":"      PrivateKey privateKey = privateKeyEntry.getPrivateKey();\n      PublicKey publicKey = certificate.getPublicKey();\n      Callable<Signature> signatureFactory = () -> Signature.getInstance(certificate.getSigAlgName());\n      int len;\n      if (publicKey instanceof RSAKey) {\n        len = ((RSAKey) publicKey).getModulus().bitLength() + 7 >> 3;\n      } else {\n        switch (certificate.getSigAlgName()) {\n          case \"SHA256withECDSA\":\n            len = 64;\n            break;\n          case \"SHA384withECDSA\":\n            len = 96;\n            break;\n          case \"SHA512withECDSA\":\n            len = 132;\n            break;\n          default:\n            throw new NoSuchAlgorithmException(certificate.getSigAlgName());\n        }\n      }\n      return DigitalSigningAlgorithm.createPubKeySigningAlgorithm(certificate.getSigAlgName(), privateKey, publicKey, \"\" + certificate.hashCode(), signatureFactory, len);\n    } else {\n      throw new UnsupportedOperationException();\n    }\n  }\n\n  /**\n   * @return a thread safe version of this instance\n   */\n  public SigningAlgorithm safe() {\n    // Make this configurable through system properties ???\n//    return new ThreadSafeSigningAlgorithm(this);\n    return new ThreadLocalSigningAlgorithm(this);\n  }\n\n  /**","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/internal/digest/SigningAlgorithm.java#L51-L87","documentation":"SigningAlgorithm.create() derives the expected signature length from the certificate's signature algorithm name; when the certificate's SigAlgName is not one of the recognized values (e.g. unknown SHA/ECDSA/RSA variant), it throws NoSuchAlgorithmException carrying that name as the message.","triggerScenarios":"Creating a signing algorithm from an X.509 certificate whose getSigAlgName() is not in the supported switch (e.g. exotic OID, SM3withRSA, SHA3 variants, or a garbled name), hitting the default branch.","commonSituations":"Certificates issued with uncommon or legacy signature algorithms; providers reporting unusual algorithm names; parsing certificates from non-standard CAs; JDK lacking support for the certificate's algorithm family.","solutions":["Re-issue/obtain a certificate signed with a supported algorithm (SHA256withRSA, SHA256withECDSA, etc.)","Extend the mapping by handling the algorithm name explicitly via createPubKeySigningAlgorithm with the correct length","Validate the certificate's algorithm before feeding it to SigningAlgorithm.create()"],"exampleFix":"// before\nSigningAlgorithm.create(certificate, priv, pub); // throws for unknown alg\n// after\nString algName = certificate.getSigAlgName();\nif (!SUPPORTED.contains(algName)) {\n  throw new IllegalArgumentException(\"Unsupported cert alg: \" + algName);\n}\nSigningAlgorithm.create(certificate, priv, pub);","handlingStrategy":"validation","validationCode":"Set.of(\"SHA256withRSA\",\"SHA384withRSA\",\"SHA512withRSA\",\"SHA256withECDSA\",\"SHA384withECDSA\",\"SHA512withECDSA\").contains(certificate.getSigAlgName())","typeGuard":null,"tryCatchPattern":"try { alg = SigningAlgorithm.create(cert, priv, pub); } catch (NoSuchAlgorithmException e) { // unsupported cert signature alg: reissue or map manually }","preventionTips":["Check certificate.getSigAlgName() against supported values before use","Issue certificates with mainstream algorithms (SHA-256/384/512 with RSA or ECDSA)","Normalize/extend algorithm-name-to-length mapping if your CA uses variants"],"tags":["x509","certificate","no-such-algorithm","jca"],"backgroundTag":"unsupported-enum-value","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}