eclipse-vertx/vert.x · error · VertxException

Invalid DER: can't handle UCS-4 string

Error message

Invalid DER: can't handle UCS-4 string

What it means

DER parsing limitation in PrivateKeyParser.getString: the string element uses ASN.1 UNIVERSAL_STRING (UCS-4), which this parser does not decode. The input at fault is the DER string element inside the parsed key/structure; such encodings are rare in key files.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/net/impl/pkcs1/PrivateKeyParser.java:513

        case DerParser.PRINTABLE_STRING:
        case DerParser.VIDEOTEX_STRING:
        case DerParser.IA5_STRING:
        case DerParser.GRAPHIC_STRING:
        case DerParser.ISO646_STRING:
        case DerParser.GENERAL_STRING:
          encoding = "ISO-8859-1";
          break;

        case DerParser.BMP_STRING:
          encoding = "UTF-16BE";
          break;

        case DerParser.UTF8_STRING:
          encoding = "UTF-8";
          break;

        case DerParser.UNIVERSAL_STRING:
          throw new VertxException("Invalid DER: can't handle UCS-4 string");

        default:
          throw new VertxException("Invalid DER: object is not a string");
      }

      try {
        return new String(value, encoding);
      } catch (UnsupportedEncodingException e) {
        throw new VertxException(e);
      }
    }
  }
}

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Re-encode the key using UTF8String/PrintableString elements
  2. Use a key produced by mainstream tooling (OpenSSL/JDK)
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/net/impl/pkcs1/PrivateKeyParser.java:513 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/1f7965d61e2c899a. Report an issue: GitHub.