diff options
| author | Kazuki Yamaguchi <k@rhe.jp> | 2025-12-14 19:33:16 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-12-14 10:46:27 +0000 |
| commit | 674c3d73e0f92d730bd2e544be344585a638ab37 (patch) | |
| tree | eaa0d49357de1b16f2888062c1ff856c8a9180cc /ext | |
| parent | 7969b654181af13f547afb88834f017694881353 (diff) | |
[ruby/openssl] pkcs7: raise OpenSSL::PKCS7::PKCS7Error in #initialize
When d2i_PKCS7_bio() and PEM_read_bio_PKCS7() fail to decode the input,
OpenSSL::PKCS7.new currently raises ArgumentError. The usual practice
in ruby/openssl where an error originates from the underlying OpenSSL
library is to raise OpenSSL::OpenSSLError.
Raise OpenSSL::PKCS7::PKCS7Error instead for consistency with
OpenSSL::PKCS7.read_smime and all other existing #initialize methods
that handle DER/PEM-encoded inputs.
https://github.com/ruby/openssl/commit/67a608ce53
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/openssl/ossl_pkcs7.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index 88f06c8831..6e51fd42b9 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -390,10 +390,10 @@ ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self) } BIO_free(in); if (!p7) - ossl_raise(rb_eArgError, "Could not parse the PKCS7"); + ossl_raise(ePKCS7Error, "Could not parse the PKCS7"); if (!p7->d.ptr) { PKCS7_free(p7); - ossl_raise(rb_eArgError, "No content in PKCS7"); + ossl_raise(ePKCS7Error, "No content in PKCS7"); } RTYPEDDATA_DATA(self) = p7; |
