@@ -208,23 +208,10 @@ public IRubyObject sign(IRubyObject digest, IRubyObject data) {
208
208
signature .update (inp );
209
209
byte [] sigge = signature .sign ();
210
210
return RubyString .newString (getRuntime (), sigge );
211
- } catch (GeneralSecurityException gse ) {
211
+ }
212
+ catch (GeneralSecurityException gse ) {
212
213
throw newPKeyError (getRuntime (), gse .getMessage ());
213
214
}
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
- */
228
215
}
229
216
230
217
@ JRubyMethod (name = "verify" )
@@ -247,11 +234,14 @@ public IRubyObject verify(IRubyObject digest, IRubyObject sig, IRubyObject data)
247
234
signature .initVerify (getPublicKey ());
248
235
signature .update (dataBytes );
249
236
valid = signature .verify (sigBytes );
250
- } catch (NoSuchAlgorithmException e ) {
237
+ }
238
+ catch (NoSuchAlgorithmException e ) {
251
239
throw newPKeyError (getRuntime (), "unsupported algorithm: " + algorithm );
252
- } catch (SignatureException e ) {
240
+ }
241
+ catch (SignatureException e ) {
253
242
throw newPKeyError (getRuntime (), "invalid signature" );
254
- } catch (InvalidKeyException e ) {
243
+ }
244
+ catch (InvalidKeyException e ) {
255
245
throw newPKeyError (getRuntime (), "invalid key" );
256
246
}
257
247
return getRuntime ().newBoolean (valid );
0 commit comments