Skip to content

Commit 42effce

Browse files
authored
Merge pull request #983 from rhenium/ky/pkcs7-init-raise-pkcs7error
pkcs7: raise OpenSSL::PKCS7::PKCS7Error in #initialize
2 parents 3c38181 + 67a608c commit 42effce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/openssl/ossl_pkcs7.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,10 @@ ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self)
390390
}
391391
BIO_free(in);
392392
if (!p7)
393-
ossl_raise(rb_eArgError, "Could not parse the PKCS7");
393+
ossl_raise(ePKCS7Error, "Could not parse the PKCS7");
394394
if (!p7->d.ptr) {
395395
PKCS7_free(p7);
396-
ossl_raise(rb_eArgError, "No content in PKCS7");
396+
ossl_raise(ePKCS7Error, "No content in PKCS7");
397397
}
398398

399399
RTYPEDDATA_DATA(self) = p7;

test/openssl/test_pkcs7.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def test_data
304304

305305
def test_empty_signed_data_ruby_bug_19974
306306
data = "-----BEGIN PKCS7-----\nMAsGCSqGSIb3DQEHAg==\n-----END PKCS7-----\n"
307-
assert_raise(ArgumentError) { OpenSSL::PKCS7.new(data) }
307+
assert_raise(OpenSSL::PKCS7::PKCS7Error) { OpenSSL::PKCS7.new(data) }
308308

309309
data = <<END
310310
MIME-Version: 1.0
@@ -319,7 +319,7 @@ def test_empty_signed_data_ruby_bug_19974
319319

320320
def test_graceful_parsing_failure #[ruby-core:43250]
321321
contents = "not a valid PKCS #7 PEM block"
322-
assert_raise(ArgumentError) { OpenSSL::PKCS7.new(contents) }
322+
assert_raise(OpenSSL::PKCS7::PKCS7Error) { OpenSSL::PKCS7.new(contents) }
323323
end
324324

325325
def test_set_type_signed

0 commit comments

Comments
 (0)