summaryrefslogtreecommitdiff
path: root/test/openssl
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2023-11-11 16:36:39 -0800
committerKazuki Yamaguchi <[email protected]>2024-05-02 16:26:11 +0900
commit55720f372d65aaa14bf6925730f0c715f0179dc5 (patch)
treeddbaaab81fe38379444bab961773a4f7277521ad /test/openssl
parentc9aa63a9e06c21566c6fadda5945f04f341e4891 (diff)
[ruby/openssl] pkcs7: raise PKCS7Error for PKCS7 without content in PKCS7.read_smime
[pkuzco: expanded the fix for other content types] [ky: adjusted formatting and the exception type] https://github.com/ruby/openssl/commit/07eceb7f63 Co-authored-by: pkuzco <[email protected]> Co-authored-by: Kazuki Yamaguchi <[email protected]>
Diffstat (limited to 'test/openssl')
-rw-r--r--test/openssl/test_pkcs7.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/openssl/test_pkcs7.rb b/test/openssl/test_pkcs7.rb
index fa15bdbca7..96f3f1f6be 100644
--- a/test/openssl/test_pkcs7.rb
+++ b/test/openssl/test_pkcs7.rb
@@ -158,6 +158,16 @@ class OpenSSL::TestPKCS7 < OpenSSL::TestCase
def test_empty_signed_data_ruby_bug_19974
data = "-----BEGIN PKCS7-----\nMAsGCSqGSIb3DQEHAg==\n-----END PKCS7-----\n"
assert_raise(ArgumentError) { OpenSSL::PKCS7.new(data) }
+
+ data = <<END
+MIME-Version: 1.0
+Content-Disposition: attachment; filename="smime.p7m"
+Content-Type: application/x-pkcs7-mime; smime-type=signed-data; name="smime.p7m"
+Content-Transfer-Encoding: base64
+
+#{data}
+END
+ assert_raise(OpenSSL::PKCS7::PKCS7Error) { OpenSSL::PKCS7.read_smime(data) }
end
def test_graceful_parsing_failure #[ruby-core:43250]