Skip to content

Commit f7f1009

Browse files
committed
[fix] do not check empty string as curve name
1 parent 5315832 commit f7f1009

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

src/main/java/org/jruby/ext/openssl/PKeyEC.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject[] a
255255
final RubyString str = readInitArg(context, arg);
256256
final String strJava = str.toString();
257257

258-
if ( isCurveName(strJava) ) {
258+
if (!strJava.isEmpty() && isCurveName(strJava)) {
259259
this.curveName = strJava;
260260
return this;
261261
}
@@ -311,22 +311,6 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject[] a
311311
else debugStackTrace(runtime, e);
312312
}
313313
}
314-
// if ( key == null && ! noClassDef ) {
315-
// try { // readECParameters
316-
// ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(str.getBytes());
317-
// ECNamedCurveParameterSpec paramSpec = ECNamedCurveTable.getParameterSpec(oid.getId());
318-
//
319-
// // ecdsaFactory.generatePublic(keySpec)
320-
//
321-
// }
322-
// catch (NoClassDefFoundError e) { noClassDef = true; debugStackTrace(runtime, e); }
323-
// catch (InvalidKeySpecException e) { debug(runtime, "PKeyEC could not read public key", e); }
324-
// catch (IOException e) { debug(runtime, "PKeyEC could not read public key", e); }
325-
// catch (RuntimeException e) {
326-
// if ( isKeyGenerationFailure(e) ) debug(runtime, "PKeyEC could not read public key", e);
327-
// else debugStackTrace(runtime, e);
328-
// }
329-
// }
330314

331315
if ( key == null ) key = tryPKCS8EncodedKey(runtime, ecdsaFactory, str.getBytes());
332316
if ( key == null ) key = tryX509EncodedKey(runtime, ecdsaFactory, str.getBytes());

0 commit comments

Comments
 (0)