Maybe I posted too many stuff. What my problem is "openssl smime" command signed everything fed to it. For example, I wanted to sign the following email body.
/*Hi there, This is an test email.* / And after signed, the email became something like below, /Received: from localhost [127.0.0.1] by with HTTP; Thu, 11 Jul 2019 16:24:33 +1000 Date: Thu, 11 Jul 2019 16:24:33 +1000 To: Kerry Fly <kerry-...@xxx.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----5D53D58F876671D7CA85A8CD28305ABB" This is an S/MIME signed message ------5D53D58F876671D7CA85A8CD28305ABB *Hi there, This is an test email.* ------5D53D58F876671D7CA85A8CD28305ABB Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" MIIIFAYJKoZIhvcNAQcCoIIIBTCCCAECAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggVmMIIFYjCCBEqgAwIBAgISA2D+gfTao7ImMR5FeJceYRQOMA0G ... Y/5+MrMjklc= ------5D53D58F876671D7CA85A8CD28305ABB--/ And if I pass the email content with some headers, smime will wrap the header inside, too. Like below /Received: from localhost [127.0.0.1] by with HTTP; Thu, 11 Jul 2019 16:24:33 +1000 Date: Thu, 11 Jul 2019 16:24:33 +1000 MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----5D53D58F876671D7CA85A8CD28305ABB" This is an S/MIME signed message ------5D53D58F876671D7CA85A8CD28305ABB *Received: from localhost [127.0.0.1] by with HTTP; Thu, 11 Jul 2019 16:24:33 +1000 Date: Thu, 11 Jul 2019 16:24:33 +1000 To: Kerry Fly <kerry-...@xxx.com> From: email_market...@xxx.com Reply-To: email_market...@xxx.com Subject: New T-shirt arrived Message-ID: <iamrfvkiuviewn0vfdckd9c3n3dzoldcyhkk8v...@xxx.com> X-Mailer: xxx.com X-MessageID: ABsLBhQBCA4 X-ListMember: kerry-...@xxx.com Precedence: bulk List-Unsubscribe: <http://xxx.com/email_marketing/email_marketing_subscribers/unsubsc ribe/ABsLBhQBCA4> List-Owner: <mailto:email_market...@xxx.com> Error-To: email_marketing_bou...@xxx.com Bounces-To: email_marketing_bou...@xxx.com Hi there, This is an test email.* ------5D53D58F876671D7CA85A8CD28305ABB Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" MIIIFAYJKoZIhvcNAQcCoIIIBTCCCAECAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggVmMIIFYjCCBEqgAwIBAgISA2D+gfTao7ImMR5FeJceYRQOMA0G ... Y/5+MrMjklc= ------5D53D58F876671D7CA85A8CD28305ABB--/ Then the header inside smime cannot be seen by receiver, like gmail. And in this way, I cannot send emails. So my question is that is there a way to use "openssl smime" to sign some email with headers? Thank you in advance. -- Sent from: http://openssl.6102.n7.nabble.com/OpenSSL-User-f3.html