From 11acded33e896007be0a274202a92a96525f690a Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Fri, 26 Oct 2012 21:32:51 -0500 Subject: [PATCH 1/2] Add tests for PKCS7#type= and add_data. --- test/openssl/test_pkcs7.rb | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/test/openssl/test_pkcs7.rb b/test/openssl/test_pkcs7.rb index 4a6692a74ccc24..c349256913aebf 100644 --- a/test/openssl/test_pkcs7.rb +++ b/test/openssl/test_pkcs7.rb @@ -151,6 +151,73 @@ def test_graceful_parsing_failure #[ruby-core:43250] contents = File.read(__FILE__) assert_raise(ArgumentError) { OpenSSL::PKCS7.new(contents) } end + + def test_set_type_signed + p7 = OpenSSL::PKCS7.new + p7.type = "signed" + assert_equal(p7.type, :signed) + end + + def test_set_type_data + p7 = OpenSSL::PKCS7.new + p7.type = "data" + assert_equal(p7.type, :data) + end + + def test_set_type_signed_and_enveloped + p7 = OpenSSL::PKCS7.new + p7.type = "signedAndEnveloped" + assert_equal(p7.type, :signedAndEnveloped) + end + + def test_set_type_enveloped + p7 = OpenSSL::PKCS7.new + p7.type = "enveloped" + assert_equal(p7.type, :enveloped) + end + + def test_set_type_encrypted + p7 = OpenSSL::PKCS7.new + p7.type = "encrypted" + assert_equal(p7.type, :encrypted) + end + + def test_degenerate_pkcs7 + ca_cert_pem = < Date: Fri, 26 Oct 2012 21:46:55 -0500 Subject: [PATCH 2/2] Add test for split PKCS7 content. --- test/openssl/test_pkcs7.rb | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/test/openssl/test_pkcs7.rb b/test/openssl/test_pkcs7.rb index c349256913aebf..0b0d808a90292f 100644 --- a/test/openssl/test_pkcs7.rb +++ b/test/openssl/test_pkcs7.rb @@ -218,6 +218,80 @@ def test_degenerate_pkcs7 p7.to_pem end end + + def test_split_content + pki_message_pem = <