eclipse-vertx/vert.x · error · VertxException

Missing private key

Error message

Missing private key

What it means

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.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java:269

      }
    }
    if (alias != null) {
      if (!ks.containsAlias(alias)) {
        throw new IllegalArgumentException("alias does not exist in the keystore: " + alias);
      }
      List<String> ksAliases = Collections.list(ks.aliases());
      for (String ksAlias : ksAliases) {
        if (!alias.equals(ksAlias)) {
          ks.deleteEntry(ksAlias);
        }
      }
    }
    return ks;
  }

  public static KeyStore loadKeyCert(List<Buffer> keyValue, List<Buffer> certValue) throws Exception {
    if (keyValue.size() < certValue.size()) {
      throw new VertxException("Missing private key");
    } else if (keyValue.size() > certValue.size()) {
      throw new VertxException("Missing X.509 certificate");
    }
    final KeyStore keyStore = createEmptyKeyStore();
    Iterator<Buffer> keyValueIt = keyValue.iterator();
    Iterator<Buffer> certValueIt = certValue.iterator();
    int index = 0;
    while (keyValueIt.hasNext() && certValueIt.hasNext()) {
      PrivateKey key = loadPrivateKey(keyValueIt.next());
      Certificate[] chain = loadCerts(certValueIt.next());
      keyStore.setEntry("dummy-entry-" + index++, new KeyStore.PrivateKeyEntry(key, chain), new KeyStore.PasswordProtection(DUMMY_PASSWORD.toCharArray()));
    }
    return keyStore;
  }

  private static PrivateKey loadPrivateKey(Buffer keyValue) throws Exception {
    if (keyValue == null) {
      throw new RuntimeException("Missing private key path");

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Supply one private key for every certificate (equal-size lists)
  2. Re-export the PEM files so keys and certs pair correctly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java:269 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/849bbd3f8599f40f. Report an issue: GitHub.