Skip to content

Commit 81e451d

Browse files
committed
cleanup/formatting at PKey's
1 parent fe55d99 commit 81e451d

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

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

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -208,23 +208,10 @@ public IRubyObject sign(IRubyObject digest, IRubyObject data) {
208208
signature.update(inp);
209209
byte[] sigge = signature.sign();
210210
return RubyString.newString(getRuntime(), sigge);
211-
} catch (GeneralSecurityException gse) {
211+
}
212+
catch (GeneralSecurityException gse) {
212213
throw newPKeyError(getRuntime(), gse.getMessage());
213214
}
214-
/*
215-
GetPKey(self, pkey);
216-
EVP_SignInit(&ctx, GetDigestPtr(digest));
217-
StringValue(data);
218-
EVP_SignUpdate(&ctx, RSTRING(data)->ptr, RSTRING(data)->len);
219-
str = rb_str_new(0, EVP_PKEY_size(pkey)+16);
220-
if (!EVP_SignFinal(&ctx, RSTRING(str)->ptr, &buf_len, pkey))
221-
ossl_raise(ePKeyError, NULL);
222-
assert(buf_len <= RSTRING(str)->len);
223-
RSTRING(str)->len = buf_len;
224-
RSTRING(str)->ptr[buf_len] = 0;
225-
226-
return str;
227-
*/
228215
}
229216

230217
@JRubyMethod(name = "verify")
@@ -247,11 +234,14 @@ public IRubyObject verify(IRubyObject digest, IRubyObject sig, IRubyObject data)
247234
signature.initVerify(getPublicKey());
248235
signature.update(dataBytes);
249236
valid = signature.verify(sigBytes);
250-
} catch (NoSuchAlgorithmException e) {
237+
}
238+
catch (NoSuchAlgorithmException e) {
251239
throw newPKeyError(getRuntime(), "unsupported algorithm: " + algorithm);
252-
} catch (SignatureException e) {
240+
}
241+
catch (SignatureException e) {
253242
throw newPKeyError(getRuntime(), "invalid signature");
254-
} catch (InvalidKeyException e) {
243+
}
244+
catch (InvalidKeyException e) {
255245
throw newPKeyError(getRuntime(), "invalid key");
256246
}
257247
return getRuntime().newBoolean(valid);

0 commit comments

Comments
 (0)