| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "OPENSSL-SMIME 1SSL" |
| 58 |
.TH OPENSSL-SMIME 1SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
openssl\-smime \- S/MIME command |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
\&\fBopenssl\fR \fBsmime\fR |
| 68 |
[\fB\-help\fR] |
| 69 |
[\fB\-encrypt\fR] |
| 70 |
[\fB\-decrypt\fR] |
| 71 |
[\fB\-sign\fR] |
| 72 |
[\fB\-resign\fR] |
| 73 |
[\fB\-verify\fR] |
| 74 |
[\fB\-pk7out\fR] |
| 75 |
[\fB\-binary\fR] |
| 76 |
[\fB\-crlfeol\fR] |
| 77 |
[\fB\-\fR\f(BIcipher\fR] |
| 78 |
[\fB\-in\fR \fIfile\fR] |
| 79 |
[\fB\-certfile\fR \fIfile\fR] |
| 80 |
[\fB\-signer\fR \fIfile\fR] |
| 81 |
[\fB\-nointern\fR] |
| 82 |
[\fB\-noverify\fR] |
| 83 |
[\fB\-nochain\fR] |
| 84 |
[\fB\-nosigs\fR] |
| 85 |
[\fB\-nocerts\fR] |
| 86 |
[\fB\-noattr\fR] |
| 87 |
[\fB\-nodetach\fR] |
| 88 |
[\fB\-nosmimecap\fR] |
| 89 |
[\fB\-recip\fR \fI file\fR] |
| 90 |
[\fB\-inform\fR \fBDER\fR|\fBPEM\fR|\fBSMIME\fR] |
| 91 |
[\fB\-outform\fR \fBDER\fR|\fBPEM\fR|\fBSMIME\fR] |
| 92 |
[\fB\-keyform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR] |
| 93 |
[\fB\-passin\fR \fIarg\fR] |
| 94 |
[\fB\-inkey\fR \fIfilename\fR|\fIuri\fR] |
| 95 |
[\fB\-out\fR \fIfile\fR] |
| 96 |
[\fB\-content\fR \fIfile\fR] |
| 97 |
[\fB\-to\fR \fIaddr\fR] |
| 98 |
[\fB\-from\fR \fIad\fR] |
| 99 |
[\fB\-subject\fR \fIs\fR] |
| 100 |
[\fB\-text\fR] |
| 101 |
[\fB\-indef\fR] |
| 102 |
[\fB\-noindef\fR] |
| 103 |
[\fB\-stream\fR] |
| 104 |
[\fB\-md\fR \fIdigest\fR] |
| 105 |
[\fB\-CAfile\fR \fIfile\fR] |
| 106 |
[\fB\-no\-CAfile\fR] |
| 107 |
[\fB\-CApath\fR \fIdir\fR] |
| 108 |
[\fB\-no\-CApath\fR] |
| 109 |
[\fB\-CAstore\fR \fIuri\fR] |
| 110 |
[\fB\-no\-CAstore\fR] |
| 111 |
[\fB\-engine\fR \fIid\fR] |
| 112 |
[\fB\-rand\fR \fIfiles\fR] |
| 113 |
[\fB\-writerand\fR \fIfile\fR] |
| 114 |
[\fB\-allow_proxy_certs\fR] |
| 115 |
[\fB\-attime\fR \fItimestamp\fR] |
| 116 |
[\fB\-no_check_time\fR] |
| 117 |
[\fB\-check_ss_sig\fR] |
| 118 |
[\fB\-crl_check\fR] |
| 119 |
[\fB\-crl_check_all\fR] |
| 120 |
[\fB\-explicit_policy\fR] |
| 121 |
[\fB\-extended_crl\fR] |
| 122 |
[\fB\-ignore_critical\fR] |
| 123 |
[\fB\-inhibit_any\fR] |
| 124 |
[\fB\-inhibit_map\fR] |
| 125 |
[\fB\-partial_chain\fR] |
| 126 |
[\fB\-policy\fR \fIarg\fR] |
| 127 |
[\fB\-policy_check\fR] |
| 128 |
[\fB\-policy_print\fR] |
| 129 |
[\fB\-purpose\fR \fIpurpose\fR] |
| 130 |
[\fB\-suiteB_128\fR] |
| 131 |
[\fB\-suiteB_128_only\fR] |
| 132 |
[\fB\-suiteB_192\fR] |
| 133 |
[\fB\-trusted_first\fR] |
| 134 |
[\fB\-no_alt_chains\fR] |
| 135 |
[\fB\-use_deltas\fR] |
| 136 |
[\fB\-auth_level\fR \fInum\fR] |
| 137 |
[\fB\-verify_depth\fR \fInum\fR] |
| 138 |
[\fB\-verify_email\fR \fIemail\fR] |
| 139 |
[\fB\-verify_hostname\fR \fIhostname\fR] |
| 140 |
[\fB\-verify_ip\fR \fIip\fR] |
| 141 |
[\fB\-verify_name\fR \fIname\fR] |
| 142 |
[\fB\-x509_strict\fR] |
| 143 |
[\fB\-issuer_checks\fR] |
| 144 |
[\fB\-provider\fR \fIname\fR] |
| 145 |
[\fB\-provider\-path\fR \fIpath\fR] |
| 146 |
[\fB\-provparam\fR \fI[name:]key=value\fR] |
| 147 |
[\fB\-propquery\fR \fIpropq\fR] |
| 148 |
[\fB\-config\fR \fIconfigfile\fR] |
| 149 |
\&\fIrecipcert\fR ... |
| 150 |
.SH DESCRIPTION |
| 151 |
.IX Header "DESCRIPTION" |
| 152 |
This command handles S/MIME mail. It can encrypt, decrypt, sign |
| 153 |
and verify S/MIME messages. |
| 154 |
.SH OPTIONS |
| 155 |
.IX Header "OPTIONS" |
| 156 |
There are six operation options that set the type of operation to be performed: |
| 157 |
\&\fB\-encrypt\fR, \fB\-decrypt\fR, \fB\-sign\fR, \fB\-resign\fR, \fB\-verify\fR, and \fB\-pk7out\fR. |
| 158 |
These are mutually exclusive. |
| 159 |
The meaning of the other options varies according to the operation type. |
| 160 |
.IP \fB\-help\fR 4 |
| 161 |
.IX Item "-help" |
| 162 |
Print out a usage message. |
| 163 |
.IP \fB\-encrypt\fR 4 |
| 164 |
.IX Item "-encrypt" |
| 165 |
Encrypt mail for the given recipient certificates. Input file is the message |
| 166 |
to be encrypted. The output file is the encrypted mail in MIME format. |
| 167 |
.Sp |
| 168 |
Note that no revocation check is done for the recipient cert, so if that |
| 169 |
key has been compromised, others may be able to decrypt the text. |
| 170 |
.IP \fB\-decrypt\fR 4 |
| 171 |
.IX Item "-decrypt" |
| 172 |
Decrypt mail using the supplied certificate and private key. Expects an |
| 173 |
encrypted mail message in MIME format for the input file. The decrypted mail |
| 174 |
is written to the output file. |
| 175 |
.IP \fB\-sign\fR 4 |
| 176 |
.IX Item "-sign" |
| 177 |
Sign mail using the supplied certificate and private key. Input file is |
| 178 |
the message to be signed. The signed message in MIME format is written |
| 179 |
to the output file. |
| 180 |
.IP \fB\-resign\fR 4 |
| 181 |
.IX Item "-resign" |
| 182 |
Resign a message: take an existing message and one or more new signers. |
| 183 |
.IP \fB\-verify\fR 4 |
| 184 |
.IX Item "-verify" |
| 185 |
Verify signed mail. Expects a signed mail message on input and outputs |
| 186 |
the signed data. Both clear text and opaque signing is supported. |
| 187 |
.IP \fB\-pk7out\fR 4 |
| 188 |
.IX Item "-pk7out" |
| 189 |
Takes an input message and writes out a PEM encoded PKCS#7 structure. |
| 190 |
.IP "\fB\-in\fR \fIfilename\fR" 4 |
| 191 |
.IX Item "-in filename" |
| 192 |
The input message to be encrypted or signed or the MIME message to |
| 193 |
be decrypted or verified. |
| 194 |
.IP "\fB\-out\fR \fIfilename\fR" 4 |
| 195 |
.IX Item "-out filename" |
| 196 |
The message text that has been decrypted or verified or the output MIME |
| 197 |
format message that has been signed or verified. |
| 198 |
.IP "\fB\-inform\fR \fBDER\fR|\fBPEM\fR|\fBSMIME\fR" 4 |
| 199 |
.IX Item "-inform DER|PEM|SMIME" |
| 200 |
The input format of the PKCS#7 (S/MIME) structure (if one is being read); |
| 201 |
the default is \fBSMIME\fR. |
| 202 |
See \fBopenssl\-format\-options\fR\|(1) for details. |
| 203 |
.IP "\fB\-outform\fR \fBDER\fR|\fBPEM\fR|\fBSMIME\fR" 4 |
| 204 |
.IX Item "-outform DER|PEM|SMIME" |
| 205 |
The output format of the PKCS#7 (S/MIME) structure (if one is being written); |
| 206 |
the default is \fBSMIME\fR. |
| 207 |
See \fBopenssl\-format\-options\fR\|(1) for details. |
| 208 |
.IP "\fB\-keyform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR" 4 |
| 209 |
.IX Item "-keyform DER|PEM|P12|ENGINE" |
| 210 |
The key format; unspecified by default. |
| 211 |
See \fBopenssl\-format\-options\fR\|(1) for details. |
| 212 |
.IP "\fB\-stream\fR, \fB\-indef\fR" 4 |
| 213 |
.IX Item "-stream, -indef" |
| 214 |
The \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable streaming I/O |
| 215 |
for encoding operations. This permits single pass processing of data without |
| 216 |
the need to hold the entire contents in memory, potentially supporting very |
| 217 |
large files. Streaming is automatically set for S/MIME signing with detached |
| 218 |
data if the output format is \fBSMIME\fR it is currently off by default for all |
| 219 |
other operations. |
| 220 |
.IP \fB\-noindef\fR 4 |
| 221 |
.IX Item "-noindef" |
| 222 |
Disable streaming I/O where it would produce and indefinite length constructed |
| 223 |
encoding. This option currently has no effect. In future streaming will be |
| 224 |
enabled by default on all relevant operations and this option will disable it. |
| 225 |
.IP "\fB\-content\fR \fIfilename\fR" 4 |
| 226 |
.IX Item "-content filename" |
| 227 |
This specifies a file containing the detached content, this is only |
| 228 |
useful with the \fB\-verify\fR command. This is only usable if the PKCS#7 |
| 229 |
structure is using the detached signature form where the content is |
| 230 |
not included. This option will override any content if the input format |
| 231 |
is S/MIME and it uses the multipart/signed MIME content type. |
| 232 |
.IP \fB\-text\fR 4 |
| 233 |
.IX Item "-text" |
| 234 |
This option adds plain text (text/plain) MIME headers to the supplied |
| 235 |
message if encrypting or signing. If decrypting or verifying it strips |
| 236 |
off text headers: if the decrypted or verified message is not of MIME |
| 237 |
type text/plain then an error occurs. |
| 238 |
.IP "\fB\-md\fR \fIdigest\fR" 4 |
| 239 |
.IX Item "-md digest" |
| 240 |
Digest algorithm to use when signing or resigning. If not present then the |
| 241 |
default digest algorithm for the signing key will be used (usually SHA1). |
| 242 |
.IP \fB\-\fR\f(BIcipher\fR 4 |
| 243 |
.IX Item "-cipher" |
| 244 |
The encryption algorithm to use. For example, DES (56 bits) \- \fB\-des\fR, |
| 245 |
triple DES (168 bits) \- \fB\-des3\fR, or AES (256 bits) \- \fB\-aes256\fR. |
| 246 |
Any standard algorithm name (as used by the \fBEVP_get_cipherbyname()\fR function) |
| 247 |
can also be used, preceded by a dash, for example \fB\-aes\-128\-cbc\fR. |
| 248 |
See \fBopenssl\-enc\fR\|(1) for a list of ciphers supported by your version of OpenSSL. |
| 249 |
.Sp |
| 250 |
If not specified, AES\-256\-CBC is used as the default. Only used with \fB\-encrypt\fR. |
| 251 |
.IP \fB\-nointern\fR 4 |
| 252 |
.IX Item "-nointern" |
| 253 |
When verifying a message normally certificates (if any) included in |
| 254 |
the message are searched for the signing certificate. With this option |
| 255 |
only the certificates specified in the \fB\-certfile\fR option are used. |
| 256 |
The supplied certificates can still be used as untrusted CAs however. |
| 257 |
.IP \fB\-noverify\fR 4 |
| 258 |
.IX Item "-noverify" |
| 259 |
Do not verify the signers certificate of a signed message. |
| 260 |
.IP \fB\-nochain\fR 4 |
| 261 |
.IX Item "-nochain" |
| 262 |
Do not do chain verification of signers certificates; that is, do not |
| 263 |
use the certificates in the signed message as untrusted CAs. |
| 264 |
.IP \fB\-nosigs\fR 4 |
| 265 |
.IX Item "-nosigs" |
| 266 |
Don't try to verify the signatures on the message. |
| 267 |
.IP \fB\-nocerts\fR 4 |
| 268 |
.IX Item "-nocerts" |
| 269 |
When signing a message, the signer's certificate is normally included. |
| 270 |
With this option it is excluded. This will reduce the size of the |
| 271 |
signed message, but the verifier must have a copy of the signers certificate |
| 272 |
available locally (passed using the \fB\-certfile\fR option for example). |
| 273 |
.IP \fB\-noattr\fR 4 |
| 274 |
.IX Item "-noattr" |
| 275 |
Normally, when a message is signed, a set of attributes are included which |
| 276 |
include the signing time and supported symmetric algorithms. With this |
| 277 |
option they are not included. |
| 278 |
.IP \fB\-nodetach\fR 4 |
| 279 |
.IX Item "-nodetach" |
| 280 |
When signing a message use opaque signing. This form is more resistant |
| 281 |
to translation by mail relays but it cannot be read by mail agents that |
| 282 |
do not support S/MIME. Without this option cleartext signing with |
| 283 |
the MIME type multipart/signed is used. |
| 284 |
.IP \fB\-nosmimecap\fR 4 |
| 285 |
.IX Item "-nosmimecap" |
| 286 |
When signing a message, do not include the \fBSMIMECapabilities\fR attribute. |
| 287 |
.IP \fB\-binary\fR 4 |
| 288 |
.IX Item "-binary" |
| 289 |
Normally the input message is converted to "canonical" format which is |
| 290 |
effectively using CR and LF as end of line: as required by the S/MIME |
| 291 |
specification. When this option is present no translation occurs. This |
| 292 |
is useful when handling binary data which may not be in MIME format. |
| 293 |
.IP \fB\-crlfeol\fR 4 |
| 294 |
.IX Item "-crlfeol" |
| 295 |
Normally the output file uses a single \fBLF\fR as end of line. When this |
| 296 |
option is present \fBCRLF\fR is used instead. |
| 297 |
.IP "\fB\-certfile\fR \fIfile\fR" 4 |
| 298 |
.IX Item "-certfile file" |
| 299 |
Allows additional certificates to be specified. When signing these will |
| 300 |
be included with the message. When verifying, these will be searched for |
| 301 |
signer certificates and will be used for chain building. |
| 302 |
.Sp |
| 303 |
The input can be in PEM, DER, or PKCS#12 format. |
| 304 |
.IP "\fB\-signer\fR \fIfile\fR" 4 |
| 305 |
.IX Item "-signer file" |
| 306 |
A signing certificate when signing or resigning a message, this option can be |
| 307 |
used multiple times if more than one signer is required. If a message is being |
| 308 |
verified then the signers certificates will be written to this file if the |
| 309 |
verification was successful. |
| 310 |
.IP "\fB\-recip\fR \fIfile\fR" 4 |
| 311 |
.IX Item "-recip file" |
| 312 |
The recipients certificate when decrypting a message. This certificate |
| 313 |
must match one of the recipients of the message or an error occurs. |
| 314 |
.IP "\fB\-inkey\fR \fIfilename\fR|\fIuri\fR" 4 |
| 315 |
.IX Item "-inkey filename|uri" |
| 316 |
The private key to use when signing or decrypting. This must match the |
| 317 |
corresponding certificate. If this option is not specified then the |
| 318 |
private key must be included in the certificate file specified with |
| 319 |
the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be used |
| 320 |
multiple times to specify successive keys. |
| 321 |
.IP "\fB\-passin\fR \fIarg\fR" 4 |
| 322 |
.IX Item "-passin arg" |
| 323 |
The private key password source. For more information about the format of \fIarg\fR |
| 324 |
see \fBopenssl\-passphrase\-options\fR\|(1). |
| 325 |
.IP "\fB\-to\fR, \fB\-from\fR, \fB\-subject\fR" 4 |
| 326 |
.IX Item "-to, -from, -subject" |
| 327 |
The relevant mail headers. These are included outside the signed |
| 328 |
portion of a message so they may be included manually. If signing |
| 329 |
then many S/MIME mail clients check the signers certificate's email |
| 330 |
address matches that specified in the From: address. |
| 331 |
.IP "\fB\-allow_proxy_certs\fR, \fB\-attime\fR, \fB\-no_check_time\fR, \fB\-check_ss_sig\fR, \fB\-crl_check\fR, \fB\-crl_check_all\fR, \fB\-explicit_policy\fR, \fB\-extended_crl\fR, \fB\-ignore_critical\fR, \fB\-inhibit_any\fR, \fB\-inhibit_map\fR, \fB\-no_alt_chains\fR, \fB\-partial_chain\fR, \fB\-policy\fR, \fB\-policy_check\fR, \fB\-policy_print\fR, \fB\-purpose\fR, \fB\-suiteB_128\fR, \fB\-suiteB_128_only\fR, \fB\-suiteB_192\fR, \fB\-trusted_first\fR, \fB\-use_deltas\fR, \fB\-auth_level\fR, \fB\-verify_depth\fR, \fB\-verify_email\fR, \fB\-verify_hostname\fR, \fB\-verify_ip\fR, \fB\-verify_name\fR, \fB\-x509_strict\fR \fB\-issuer_checks\fR" 4 |
| 332 |
.IX Item "-allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks" |
| 333 |
Set various options of certificate chain verification. |
| 334 |
See "Verification Options" in \fBopenssl\-verification\-options\fR\|(1) for details. |
| 335 |
.Sp |
| 336 |
Any verification errors cause the command to exit. |
| 337 |
.IP "\fB\-CAfile\fR \fIfile\fR, \fB\-no\-CAfile\fR, \fB\-CApath\fR \fIdir\fR, \fB\-no\-CApath\fR, \fB\-CAstore\fR \fIuri\fR, \fB\-no\-CAstore\fR" 4 |
| 338 |
.IX Item "-CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore" |
| 339 |
See "Trusted Certificate Options" in \fBopenssl\-verification\-options\fR\|(1) for details. |
| 340 |
.IP "\fB\-engine\fR \fIid\fR" 4 |
| 341 |
.IX Item "-engine id" |
| 342 |
See "Engine Options" in \fBopenssl\fR\|(1). |
| 343 |
This option is deprecated. |
| 344 |
.IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4 |
| 345 |
.IX Item "-rand files, -writerand file" |
| 346 |
See "Random State Options" in \fBopenssl\fR\|(1) for details. |
| 347 |
.IP "\fB\-provider\fR \fIname\fR" 4 |
| 348 |
.IX Item "-provider name" |
| 349 |
.PD 0 |
| 350 |
.IP "\fB\-provider\-path\fR \fIpath\fR" 4 |
| 351 |
.IX Item "-provider-path path" |
| 352 |
.IP "\fB\-provparam\fR \fI[name:]key=value\fR" 4 |
| 353 |
.IX Item "-provparam [name:]key=value" |
| 354 |
.IP "\fB\-propquery\fR \fIpropq\fR" 4 |
| 355 |
.IX Item "-propquery propq" |
| 356 |
.PD |
| 357 |
See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7). |
| 358 |
.IP "\fB\-config\fR \fIconfigfile\fR" 4 |
| 359 |
.IX Item "-config configfile" |
| 360 |
See "Configuration Option" in \fBopenssl\fR\|(1). |
| 361 |
.IP "\fIrecipcert\fR ..." 4 |
| 362 |
.IX Item "recipcert ..." |
| 363 |
One or more certificates of message recipients, used when encrypting |
| 364 |
a message. |
| 365 |
.SH NOTES |
| 366 |
.IX Header "NOTES" |
| 367 |
The MIME message must be sent without any blank lines between the |
| 368 |
headers and the output. Some mail programs will automatically add |
| 369 |
a blank line. Piping the mail directly to sendmail is one way to |
| 370 |
achieve the correct format. |
| 371 |
.PP |
| 372 |
The supplied message to be signed or encrypted must include the |
| 373 |
necessary MIME headers or many S/MIME clients won't display it |
| 374 |
properly (if at all). You can use the \fB\-text\fR option to automatically |
| 375 |
add plain text headers. |
| 376 |
.PP |
| 377 |
A "signed and encrypted" message is one where a signed message is |
| 378 |
then encrypted. This can be produced by encrypting an already signed |
| 379 |
message: see the examples section. |
| 380 |
.PP |
| 381 |
This version of the program only allows one signer per message but it |
| 382 |
will verify multiple signers on received messages. Some S/MIME clients |
| 383 |
choke if a message contains multiple signers. It is possible to sign |
| 384 |
messages "in parallel" by signing an already signed message. |
| 385 |
.PP |
| 386 |
The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/MIME |
| 387 |
clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7 |
| 388 |
encrypted data is used for other purposes. |
| 389 |
.PP |
| 390 |
The \fB\-resign\fR option uses an existing message digest when adding a new |
| 391 |
signer. This means that attributes must be present in at least one existing |
| 392 |
signer using the same message digest or this operation will fail. |
| 393 |
.PP |
| 394 |
The \fB\-stream\fR and \fB\-indef\fR options enable streaming I/O support. |
| 395 |
As a result the encoding is BER using indefinite length constructed encoding |
| 396 |
and no longer DER. Streaming is supported for the \fB\-encrypt\fR operation and the |
| 397 |
\&\fB\-sign\fR operation if the content is not detached. |
| 398 |
.PP |
| 399 |
Streaming is always used for the \fB\-sign\fR operation with detached data but |
| 400 |
since the content is no longer part of the PKCS#7 structure the encoding |
| 401 |
remains DER. |
| 402 |
.SH "EXIT CODES" |
| 403 |
.IX Header "EXIT CODES" |
| 404 |
.IP 0 4 |
| 405 |
The operation was completely successfully. |
| 406 |
.IP 1 4 |
| 407 |
.IX Item "1" |
| 408 |
An error occurred parsing the command options. |
| 409 |
.IP 2 4 |
| 410 |
.IX Item "2" |
| 411 |
One of the input files could not be read. |
| 412 |
.IP 3 4 |
| 413 |
.IX Item "3" |
| 414 |
An error occurred creating the PKCS#7 file or when reading the MIME |
| 415 |
message. |
| 416 |
.IP 4 4 |
| 417 |
.IX Item "4" |
| 418 |
An error occurred decrypting or verifying the message. |
| 419 |
.IP 5 4 |
| 420 |
.IX Item "5" |
| 421 |
The message was verified correctly but an error occurred writing out |
| 422 |
the signers certificates. |
| 423 |
.SH EXAMPLES |
| 424 |
.IX Header "EXAMPLES" |
| 425 |
Create a cleartext signed message: |
| 426 |
.PP |
| 427 |
.Vb 2 |
| 428 |
\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \e |
| 429 |
\& \-signer mycert.pem |
| 430 |
.Ve |
| 431 |
.PP |
| 432 |
Create an opaque signed message: |
| 433 |
.PP |
| 434 |
.Vb 2 |
| 435 |
\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \-nodetach \e |
| 436 |
\& \-signer mycert.pem |
| 437 |
.Ve |
| 438 |
.PP |
| 439 |
Create a signed message, include some additional certificates and |
| 440 |
read the private key from another file: |
| 441 |
.PP |
| 442 |
.Vb 2 |
| 443 |
\& openssl smime \-sign \-in in.txt \-text \-out mail.msg \e |
| 444 |
\& \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem |
| 445 |
.Ve |
| 446 |
.PP |
| 447 |
Create a signed message with two signers: |
| 448 |
.PP |
| 449 |
.Vb 2 |
| 450 |
\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \e |
| 451 |
\& \-signer mycert.pem \-signer othercert.pem |
| 452 |
.Ve |
| 453 |
.PP |
| 454 |
Send a signed message under Unix directly to sendmail, including headers: |
| 455 |
.PP |
| 456 |
.Vb 3 |
| 457 |
\& openssl smime \-sign \-in in.txt \-text \-signer mycert.pem \e |
| 458 |
\& \-from [email protected] \-to someone@somewhere \e |
| 459 |
\& \-subject "Signed message" | sendmail someone@somewhere |
| 460 |
.Ve |
| 461 |
.PP |
| 462 |
Verify a message and extract the signer's certificate if successful: |
| 463 |
.PP |
| 464 |
.Vb 1 |
| 465 |
\& openssl smime \-verify \-in mail.msg \-signer user.pem \-out signedtext.txt |
| 466 |
.Ve |
| 467 |
.PP |
| 468 |
Send encrypted mail using triple DES: |
| 469 |
.PP |
| 470 |
.Vb 3 |
| 471 |
\& openssl smime \-encrypt \-in in.txt \-out mail.msg \-from [email protected] \e |
| 472 |
\& \-to someone@somewhere \-subject "Encrypted message" \e |
| 473 |
\& \-des3 user.pem |
| 474 |
.Ve |
| 475 |
.PP |
| 476 |
Sign and encrypt mail: |
| 477 |
.PP |
| 478 |
.Vb 4 |
| 479 |
\& openssl smime \-sign \-in ml.txt \-signer my.pem \-text \e |
| 480 |
\& | openssl smime \-encrypt \-out mail.msg \e |
| 481 |
\& \-from [email protected] \-to someone@somewhere \e |
| 482 |
\& \-subject "Signed and Encrypted message" \-des3 user.pem |
| 483 |
.Ve |
| 484 |
.PP |
| 485 |
Note: the encryption command does not include the \fB\-text\fR option because the |
| 486 |
message being encrypted already has MIME headers. |
| 487 |
.PP |
| 488 |
Decrypt mail: |
| 489 |
.PP |
| 490 |
.Vb 1 |
| 491 |
\& openssl smime \-decrypt \-in mail.msg \-recip mycert.pem \-inkey key.pem |
| 492 |
.Ve |
| 493 |
.PP |
| 494 |
The output from Netscape form signing is a PKCS#7 structure with the |
| 495 |
detached signature format. You can use this program to verify the |
| 496 |
signature by line wrapping the base64 encoded structure and surrounding |
| 497 |
it with: |
| 498 |
.PP |
| 499 |
.Vb 2 |
| 500 |
\& \-\-\-\-\-BEGIN PKCS7\-\-\-\-\- |
| 501 |
\& \-\-\-\-\-END PKCS7\-\-\-\-\- |
| 502 |
.Ve |
| 503 |
.PP |
| 504 |
and using the command: |
| 505 |
.PP |
| 506 |
.Vb 1 |
| 507 |
\& openssl smime \-verify \-inform PEM \-in signature.pem \-content content.txt |
| 508 |
.Ve |
| 509 |
.PP |
| 510 |
Alternatively you can base64 decode the signature and use: |
| 511 |
.PP |
| 512 |
.Vb 1 |
| 513 |
\& openssl smime \-verify \-inform DER \-in signature.der \-content content.txt |
| 514 |
.Ve |
| 515 |
.PP |
| 516 |
Create an encrypted message using 128 bit Camellia: |
| 517 |
.PP |
| 518 |
.Vb 1 |
| 519 |
\& openssl smime \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cert.pem |
| 520 |
.Ve |
| 521 |
.PP |
| 522 |
Add a signer to an existing message: |
| 523 |
.PP |
| 524 |
.Vb 1 |
| 525 |
\& openssl smime \-resign \-in mail.msg \-signer newsign.pem \-out mail2.msg |
| 526 |
.Ve |
| 527 |
.SH BUGS |
| 528 |
.IX Header "BUGS" |
| 529 |
The MIME parser isn't very clever: it seems to handle most messages that I've |
| 530 |
thrown at it but it may choke on others. |
| 531 |
.PP |
| 532 |
The code currently will only write out the signer's certificate to a file: if |
| 533 |
the signer has a separate encryption certificate this must be manually |
| 534 |
extracted. There should be some heuristic that determines the correct |
| 535 |
encryption certificate. |
| 536 |
.PP |
| 537 |
Ideally a database should be maintained of a certificates for each email |
| 538 |
address. |
| 539 |
.PP |
| 540 |
The code doesn't currently take note of the permitted symmetric encryption |
| 541 |
algorithms as supplied in the SMIMECapabilities signed attribute. This means the |
| 542 |
user has to manually include the correct encryption algorithm. It should store |
| 543 |
the list of permitted ciphers in a database and only use those. |
| 544 |
.PP |
| 545 |
No revocation checking is done on the signer's certificate. |
| 546 |
.PP |
| 547 |
The current code can only handle S/MIME v2 messages, the more complex S/MIME v3 |
| 548 |
structures may cause parsing errors. |
| 549 |
.SH "SEE ALSO" |
| 550 |
.IX Header "SEE ALSO" |
| 551 |
\&\fBossl_store\-file\fR\|(7) |
| 552 |
.SH HISTORY |
| 553 |
.IX Header "HISTORY" |
| 554 |
The default encryption cipher was changed from 3DES to AES\-256 in OpenSSL 3.5. |
| 555 |
.PP |
| 556 |
The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command were first |
| 557 |
added in OpenSSL 1.0.0 |
| 558 |
.PP |
| 559 |
The \-no_alt_chains option was added in OpenSSL 1.1.0. |
| 560 |
.PP |
| 561 |
The \fB\-engine\fR option was deprecated in OpenSSL 3.0. |
| 562 |
.SH COPYRIGHT |
| 563 |
.IX Header "COPYRIGHT" |
| 564 |
Copyright 2000\-2025 The OpenSSL Project Authors. All Rights Reserved. |
| 565 |
.PP |
| 566 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 567 |
this file except in compliance with the License. You can obtain a copy |
| 568 |
in the file LICENSE in the source distribution or at |
| 569 |
<https://www.openssl.org/source/license.html>. |