From 6c09fd3ef5422d798f6674094b9f222c3abae660 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sun, 3 Jul 2016 11:27:45 +0900 Subject: pkey: make PKey.read raise PKey::PKeyError rather than ArgumentError PKey.read is a generic method to load an arbitrary PKey structure from a PEM or DER encoded String. Each PKey classes's constructor also can load from a String, but the behavior on error is different. While they raises its own exception (are subclasses of PKey::PKeyError), PKey.read raises ArgumentError. [Bug #11774] --- ext/openssl/ossl_pkey.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/openssl/ossl_pkey.c') diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index 4ae8e14e..ee0575d8 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -158,7 +158,8 @@ ossl_pkey_new_from_data(int argc, VALUE *argv, VALUE self) BIO_free(bio); if (!pkey) - ossl_raise(rb_eArgError, "Could not parse PKey"); + ossl_raise(ePKeyError, "Could not parse PKey"); + return ossl_pkey_new(pkey); } -- cgit v1.2.3