{"record":{"id":"849bbd3f8599f40f","repo":"eclipse-vertx/vert.x","slug":"missing-private-key","errorCode":null,"errorMessage":"Missing private key","messagePattern":"Missing private key","errorType":"exception","errorClass":"VertxException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java","lineNumber":269,"sourceCode":"      }\n    }\n    if (alias != null) {\n      if (!ks.containsAlias(alias)) {\n        throw new IllegalArgumentException(\"alias does not exist in the keystore: \" + alias);\n      }\n      List<String> ksAliases = Collections.list(ks.aliases());\n      for (String ksAlias : ksAliases) {\n        if (!alias.equals(ksAlias)) {\n          ks.deleteEntry(ksAlias);\n        }\n      }\n    }\n    return ks;\n  }\n\n  public static KeyStore loadKeyCert(List<Buffer> keyValue, List<Buffer> certValue) throws Exception {\n    if (keyValue.size() < certValue.size()) {\n      throw new VertxException(\"Missing private key\");\n    } else if (keyValue.size() > certValue.size()) {\n      throw new VertxException(\"Missing X.509 certificate\");\n    }\n    final KeyStore keyStore = createEmptyKeyStore();\n    Iterator<Buffer> keyValueIt = keyValue.iterator();\n    Iterator<Buffer> certValueIt = certValue.iterator();\n    int index = 0;\n    while (keyValueIt.hasNext() && certValueIt.hasNext()) {\n      PrivateKey key = loadPrivateKey(keyValueIt.next());\n      Certificate[] chain = loadCerts(certValueIt.next());\n      keyStore.setEntry(\"dummy-entry-\" + index++, new KeyStore.PrivateKeyEntry(key, chain), new KeyStore.PasswordProtection(DUMMY_PASSWORD.toCharArray()));\n    }\n    return keyStore;\n  }\n\n  private static PrivateKey loadPrivateKey(Buffer keyValue) throws Exception {\n    if (keyValue == null) {\n      throw new RuntimeException(\"Missing private key path\");","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java#L251-L287","documentation":"Keystore validation in KeyStoreHelper.loadKeyCert: fewer private-key values were supplied than certificates, so at least one X.509 certificate has no matching private key to form a key/cert pair. The input at fault is the lists of PEM key and cert buffers configured in PemKeyCertOptions.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java:269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply one private key for every certificate (equal-size lists)","Re-export the PEM files so keys and certs pair correctly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}