eclipse-vertx/vert.x · error · RuntimeException

Missing private key path

Error message

Missing private key path

What it means

PEM parsing failure in the private-key loading path (loadPrivateKey): an IOException occurred while reading the private key file backing the buffer, e.g. the configured key path does not exist or is unreadable. The message is a path-error sentinel; the input at fault is the private key path/value configured in PemKeyCertOptions.

Source

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

      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");
    }
    KeyFactory rsaKeyFactory = KeyFactory.getInstance("RSA");
    KeyFactory ecKeyFactory = getECKeyFactory();
    List<PrivateKey> pems = loadPems(keyValue, (delimiter, content) -> {
      try {
        switch (delimiter) {
          case "EC PRIVATE KEY":
            if (ecKeyFactory == null) {
              // ECC is not supported by JVM
              return Collections.emptyList();
            } else {
              // read PEM file as described in https://datatracker.ietf.org/doc/html/rfc5915#section-4
              return Collections.singletonList(ecKeyFactory.generatePrivate(PrivateKeyParser.getECKeySpec(content)));
            }
          case "RSA PRIVATE KEY":
            return Collections.singletonList(rsaKeyFactory.generatePrivate(PrivateKeyParser.getRSAKeySpec(content)));
          case "PRIVATE KEY":
            // in PKCS#8 the key algorithm is indicated at the beginning of the ASN.1 structure

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Verify the private key path exists and is readable
  2. Check that the configured value is a valid PEM private key
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/net/impl/KeyStoreHelper.java:287 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/cb6393627b096a67. Report an issue: GitHub.