{"record":{"id":"7ba39732842a0e62","repo":"quarkusio/quarkus","slug":"algorithm-not-supported","errorCode":null,"errorMessage":"Algorithm not supported: ","messagePattern":"Algorithm not supported: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"devtools/cli/src/main/java/io/quarkus/cli/jwt/GenerateKey.java","lineNumber":41,"sourceCode":"    @Option(names = { \"-f\", \"--force\" }, description = \"Overwrite existing private/public keys\")\n    boolean force;\n\n    @Option(names = { \"-s\",\n            \"--size\" }, description = \"Key size (Defaults to 2048 for RSA, 256 for Elliptic Curve (EC). EC supports 256, 384, or 512)\")\n    int size;\n\n    @Option(names = { \"-a\", \"--algo\" }, description = \"Key algorithm: RSA or EC (Defaults to RSA)\")\n    String algo;\n\n    @Override\n    public Integer call() throws Exception {\n        if (algo != null) {\n            if (algo.equalsIgnoreCase(\"RSA\")) {\n                algo = \"RSA\";\n            } else if (algo.equalsIgnoreCase(\"EC\")) {\n                algo = \"EC\";\n            } else {\n                throw new RuntimeException(\"Algorithm not supported: \" + algo);\n            }\n        } else {\n            algo = \"RSA\";\n        }\n        if (algo.equals(\"RSA\")) {\n            if (size == 0) {\n                size = 2048;\n            }\n        } else {\n            if (size == 0) {\n                size = 256;\n            }\n        }\n\n        Path resourcesFolder = projectRoot().resolve(\"src/main/resources\");\n        if (!Files.exists(resourcesFolder))\n            Files.createDirectories(resourcesFolder);\n        Path privateKey = resourcesFolder.resolve(\"privateKey.pem\");","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/cli/src/main/java/io/quarkus/cli/jwt/GenerateKey.java#L23-L59","documentation":"GenerateKey.call validates the requested key algorithm for `quarkus generate jwt-key` (or similar JWT key generation). Only 'RSA' (default) and 'EC' are accepted; any other value throws a plain RuntimeException naming the unsupported algorithm.","triggerScenarios":"Calling the key-generation CLI with an --algorithm (algo) option value that is not 'RSA' or 'EC' (case-insensitive), e.g. 'Ed25519', 'HMAC', 'rs256', 'DSA'.","commonSituations":"Confusing JWS signature algorithm names (RS256/ES256) with key-pair algorithms (RSA/EC); expecting EdDSA support that the tool does not implement; typo like 'rsa ' with whitespace (equalsIgnoreCase still fails on non-letter chars).","solutions":["Pass --algorithm RSA or --algorithm EC (case-insensitive).","Omit the algorithm option entirely to get the RSA default.","If you need a different key type, generate it with the JDK `keytool` or OpenSSL and register the resulting JWKS manually."],"exampleFix":"// before\nquarkus generate jwt-key --algorithm RS256\n// after\nquarkus generate jwt-key --algorithm RSA","handlingStrategy":"validation","validationCode":"Set<String> SUPPORTED = Set.of(\"RSA\", \"EC\");\nif (algo != null && !SUPPORTED.contains(algo.toUpperCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(\"Use RSA or EC, got: \" + algo);\n}","typeGuard":"public static boolean isSupportedKeyAlgorithm(String algo) {\n    return \"RSA\".equalsIgnoreCase(algo) || \"EC\".equalsIgnoreCase(algo);\n}","tryCatchPattern":"try {\n    generateKey(algo, size);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Algorithm not supported\")) {\n        log.warn(\"Falling back to RSA\");\n        generateKey(\"RSA\", size);\n    } else throw e;\n}","preventionTips":["Only pass 'RSA' or 'EC' to the JWT key generator.","Do not confuse JWS alg names (RS256, ES256) with key algorithms.","Omit the option to accept the RSA default.","Check tool version docs before expecting EdDSA/HMAC support."],"tags":["cli","jwt","cryptography","unsupported-algorithm"],"backgroundTag":"unsupported-key-algorithm","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}