diff --git a/src/main/java/org/jruby/ext/openssl/PKeyEC.java b/src/main/java/org/jruby/ext/openssl/PKeyEC.java index 5e4a8624..9c0330b8 100644 --- a/src/main/java/org/jruby/ext/openssl/PKeyEC.java +++ b/src/main/java/org/jruby/ext/openssl/PKeyEC.java @@ -171,7 +171,10 @@ public static RubyArray builtin_curves(ThreadContext context, IRubyObject self) return curves; } - private static Optional getCurveOID(final String curveName) { + private static Optional getCurveOID(String curveName) { + if (curveName == null) return Optional.empty(); + // work-around getNamedCurveOid not being able to handle "... " (assuming spacePos + 1 is valid index) + if (curveName.indexOf(' ') == curveName.length() - 1) return Optional.empty(); return Optional.ofNullable(ECUtil.getNamedCurveOid(curveName)); }