From 6b1fe6a2b44f7ff7aee47693b45a544770e7b4a0 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 3 Jun 2020 16:17:03 +0000 Subject: [PATCH] add S/MIME signature mail test (#31593) git-svn-id: http://svn.redmine.org/redmine/trunk@19808 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../fixtures/mail_handler/smime_signature.eml | 89 +++++++++++++++++++ test/unit/mail_handler_test.rb | 16 ++++ 2 files changed, 105 insertions(+) create mode 100644 test/fixtures/mail_handler/smime_signature.eml diff --git a/test/fixtures/mail_handler/smime_signature.eml b/test/fixtures/mail_handler/smime_signature.eml new file mode 100644 index 000000000..61ff4f8a6 --- /dev/null +++ b/test/fixtures/mail_handler/smime_signature.eml @@ -0,0 +1,89 @@ +Return-Path: +Message-ID: +Subject: Self-Signed S/MIME signature +From: JSmith +To: +Date: Wed, 03 Jun 2020 22:29:36 +0900 +Content-Type: multipart/signed; micalg="sha-256"; + protocol="application/x-pkcs7-signature"; + boundary="=-a6R2ultRPmAp8zmxN9qV" +X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) +Mime-Version: 1.0 + + +--=-a6R2ultRPmAp8zmxN9qV +Content-Type: multipart/mixed; boundary="=-WFkuWLE/majN4BpDwkgg" + + +--=-WFkuWLE/majN4BpDwkgg +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +smime.sh.txt describes how to create Self-Signed S/MIME Certs. + +--=-WFkuWLE/majN4BpDwkgg +Content-Disposition: attachment; filename="smime.sh.txt" +Content-Type: text/plain; name="smime.sh.txt"; charset="UTF-8" +Content-Transfer-Encoding: base64 + +IyBCYXNlZCBvbiBodHRwczovL2dpc3QuZ2l0aHViLmNvbS9yaWNoaWVmb3JlbWFuLzMxNjYzODcK +Cm9wZW5zc2wgZ2VucnNhIC1kZXMzIC1vdXQgY2Eua2V5IDQwOTYKb3BlbnNzbCByZXEgLW5ldyAt +eDUwOSAtZGF5cyAzNjUwIC1rZXkgY2Eua2V5IC1vdXQgY2EuY3J0CgpvcGVuc3NsIGdlbnJzYSAt +ZGVzMyAtb3V0IHNtaW1lLmtleSA0MDk2Cm9wZW5zc2wgcmVxIC1uZXcgLWtleSBzbWltZS5rZXkg +LW91dCBzbWltZS5jc3IKb3BlbnNzbCB4NTA5IC1yZXEgLWRheXMgMzY1MCAtaW4gc21pbWUuY3Ny +IC1DQSBjYS5jcnQgLUNBa2V5IGNhLmtleSBcCiAgICAtc2V0X3NlcmlhbCAxIC1vdXQgc21pbWUu +Y3J0IC1zZXRhbGlhcyAiU2VsZiBTaWduZWQgU01JTUUiIFwKICAgIC1hZGR0cnVzdCBlbWFpbFBy +b3RlY3Rpb24gLWFkZHJlamVjdCBjbGllbnRBdXRoIC1hZGRyZWplY3Qgc2VydmVyQXV0aCAtdHJ1 +c3RvdXQKb3BlbnNzbCBwa2NzMTIgLWV4cG9ydCAtaW4gc21pbWUuY3J0IC1pbmtleSBzbWltZS5r +ZXkgLW91dCBzbWltZS5wMTIK + + +--=-WFkuWLE/majN4BpDwkgg-- + +--=-a6R2ultRPmAp8zmxN9qV +Content-Type: application/x-pkcs7-signature; name="smime.p7s" +Content-Disposition: attachment; filename="smime.p7s" +Content-Transfer-Encoding: base64 + +MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCBSEw +ggUdMIIDBQIBATANBgkqhkiG9w0BAQsFADBCMQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVs +dCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkgTHRkMCAXDTIwMDYwMTEzMzA1NloYDzIx +MjAwNTA4MTMzMDU2WjBlMQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYD +VQQKDBNEZWZhdWx0IENvbXBhbnkgTHRkMSEwHwYJKoZIhvcNAQkBFhJKU21pdGhAc29tZW5ldC5m +b28wggIiMA0GCSqGSIb3DQEBAQUA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3AVSmOc4mviQSJ7F0Iq5/N9uMD3zAAT +EQRhHOuv1sE9h702Qv6ecj5IVp3RhcudL97y9E9mtHYq9Ixypg0argOUF3ACt3KREG2Vnhc+IbNI +yP9WNpcdOsl3ZhlTVbk4nGsomeVaUf2sgfHyqB7BlHYZiztO9CfYNBSbizArjS3qKB+7pIMHLOxV +Z0eWZUQfOwd7SSEkQYvl3SC1czXxKSRRWkE3hgbIDE0A0veJBZw9PWFfrSBmsLIJfbSAh2mRAAAA +AAAA + + +--=-a6R2ultRPmAp8zmxN9qV-- + diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 630bf5fc7..489106379 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -1282,6 +1282,22 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal false, MailHandler.safe_receive end + def test_smine_signature + issue = submit_email('smime_signature.eml', :issue => {:project => 'onlinestore'}) + assert issue.is_a?(Issue) + assert !issue.new_record? + issue.reload + assert_equal 'Self-Signed S/MIME signature', issue.subject + assert_equal User.find_by_login('jsmith'), issue.author + assert_equal Project.find(2), issue.project + assert_equal 'smime.sh.txt describes how to create Self-Signed S/MIME Certs.', issue.description + assert_equal 2, issue.attachments.size + assert_equal 'smime.sh.txt', issue.attachments[0].filename + assert_equal 'text/plain', issue.attachments[0].content_type + assert_equal 'smime.p7s', issue.attachments[1].filename + assert_equal 'application/x-pkcs7-signature', issue.attachments[1].content_type + end + private def submit_email(filename, options={}) -- 2.39.5