Ensure configured module specific and application specific defines are used
[openssl.git] / doc / man1 / cms.pod
1 =pod
2
3 =head1 NAME
4
5 openssl-cms,
6 cms - CMS utility
7
8 =head1 SYNOPSIS
9
10 B<openssl> B<cms>
11 [B<-help>]
12 [B<-encrypt>]
13 [B<-decrypt>]
14 [B<-sign>]
15 [B<-verify>]
16 [B<-cmsout>]
17 [B<-resign>]
18 [B<-cades>]
19 [B<-data_create>]
20 [B<-data_out>]
21 [B<-digest_create>]
22 [B<-digest_verify>]
23 [B<-compress>]
24 [B<-uncompress>]
25 [B<-EncryptedData_encrypt>]
26 [B<-sign_receipt>]
27 [B<-verify_receipt receipt>]
28 [B<-in filename>]
29 [B<-inform SMIME|PEM|DER>]
30 [B<-rctform SMIME|PEM|DER>]
31 [B<-out filename>]
32 [B<-outform SMIME|PEM|DER>]
33 [B<-stream -indef -noindef>]
34 [B<-noindef>]
35 [B<-content filename>]
36 [B<-text>]
37 [B<-noout>]
38 [B<-print>]
39 [B<-CAfile file>]
40 [B<-CApath dir>]
41 [B<-no-CAfile>]
42 [B<-no-CApath>]
43 [B<-attime timestamp>]
44 [B<-check_ss_sig>]
45 [B<-crl_check>]
46 [B<-crl_check_all>]
47 [B<-explicit_policy>]
48 [B<-extended_crl>]
49 [B<-ignore_critical>]
50 [B<-inhibit_any>]
51 [B<-inhibit_map>]
52 [B<-no_check_time>]
53 [B<-partial_chain>]
54 [B<-policy arg>]
55 [B<-policy_check>]
56 [B<-policy_print>]
57 [B<-purpose purpose>]
58 [B<-suiteB_128>]
59 [B<-suiteB_128_only>]
60 [B<-suiteB_192>]
61 [B<-trusted_first>]
62 [B<-no_alt_chains>]
63 [B<-use_deltas>]
64 [B<-auth_level num>]
65 [B<-verify_depth num>]
66 [B<-verify_email email>]
67 [B<-verify_hostname hostname>]
68 [B<-verify_ip ip>]
69 [B<-verify_name name>]
70 [B<-x509_strict>]
71 [B<-md digest>]
72 [B<-I<cipher>>]
73 [B<-nointern>]
74 [B<-noverify>]
75 [B<-nocerts>]
76 [B<-noattr>]
77 [B<-nosmimecap>]
78 [B<-binary>]
79 [B<-crlfeol>]
80 [B<-asciicrlf>]
81 [B<-nodetach>]
82 [B<-certfile file>]
83 [B<-certsout file>]
84 [B<-signer file>]
85 [B<-recip file>]
86 [B<-keyid>]
87 [B<-receipt_request_all>]
88 [B<-receipt_request_first>]
89 [B<-receipt_request_from emailaddress>]
90 [B<-receipt_request_to emailaddress>]
91 [B<-receipt_request_print>]
92 [B<-secretkey key>]
93 [B<-secretkeyid id>]
94 [B<-econtent_type type>]
95 [B<-inkey file>]
96 [B<-keyopt name:parameter>]
97 [B<-passin arg>]
98 [B<-rand file...>]
99 [B<-writerand file>]
100 [B<cert.pem...>]
101 [B<-to addr>]
102 [B<-from addr>]
103 [B<-subject subj>]
104 [cert.pem]...
105
106 =head1 DESCRIPTION
107
108 The B<cms> command handles S/MIME v3.1 mail. It can encrypt, decrypt, sign and
109 verify, compress and uncompress S/MIME messages.
110
111 =head1 OPTIONS
112
113 There are fourteen operation options that set the type of operation to be
114 performed. The meaning of the other options varies according to the operation
115 type.
116
117 =over 4
118
119 =item B<-help>
120
121 Print out a usage message.
122
123 =item B<-encrypt>
124
125 Encrypt mail for the given recipient certificates. Input file is the message
126 to be encrypted. The output file is the encrypted mail in MIME format. The
127 actual CMS type is <B>EnvelopedData<B>.
128
129 Note that no revocation check is done for the recipient cert, so if that
130 key has been compromised, others may be able to decrypt the text.
131
132 =item B<-decrypt>
133
134 Decrypt mail using the supplied certificate and private key. Expects an
135 encrypted mail message in MIME format for the input file. The decrypted mail
136 is written to the output file.
137
138 =item B<-debug_decrypt>
139
140 This option sets the B<CMS_DEBUG_DECRYPT> flag. This option should be used
141 with caution: see the notes section below.
142
143 =item B<-sign>
144
145 Sign mail using the supplied certificate and private key. Input file is
146 the message to be signed. The signed message in MIME format is written
147 to the output file.
148
149 =item B<-verify>
150
151 Verify signed mail. Expects a signed mail message on input and outputs
152 the signed data. Both clear text and opaque signing is supported.
153
154 =item B<-cmsout>
155
156 Takes an input message and writes out a PEM encoded CMS structure.
157
158 =item B<-resign>
159
160 Resign a message: take an existing message and one or more new signers.
161
162 =item B<-cades>
163
164 Add an ESS signing-certificate or ESS signing-certificate-v2 signed-attribute to the SignerInfo, in order to make
165 the signature comply with the requirements for a CAdES Basic Electronic Signature (CAdES-BES). See the NOTES
166 section for more details.
167
168 =item B<-data_create>
169
170 Create a CMS B<Data> type.
171
172 =item B<-data_out>
173
174 B<Data> type and output the content.
175
176 =item B<-digest_create>
177
178 Create a CMS B<DigestedData> type.
179
180 =item B<-digest_verify>
181
182 Verify a CMS B<DigestedData> type and output the content.
183
184 =item B<-compress>
185
186 Create a CMS B<CompressedData> type. OpenSSL must be compiled with B<zlib>
187 support for this option to work, otherwise it will output an error.
188
189 =item B<-uncompress>
190
191 Uncompress a CMS B<CompressedData> type and output the content. OpenSSL must be
192 compiled with B<zlib> support for this option to work, otherwise it will
193 output an error.
194
195 =item B<-EncryptedData_encrypt>
196
197 Encrypt content using supplied symmetric key and algorithm using a CMS
198 B<EncryptedData> type and output the content.
199
200 =item B<-sign_receipt>
201
202 Generate and output a signed receipt for the supplied message. The input
203 message B<must> contain a signed receipt request. Functionality is otherwise
204 similar to the B<-sign> operation.
205
206 =item B<-verify_receipt receipt>
207
208 Verify a signed receipt in filename B<receipt>. The input message B<must>
209 contain the original receipt request. Functionality is otherwise similar
210 to the B<-verify> operation.
211
212 =item B<-in filename>
213
214 The input message to be encrypted or signed or the message to be decrypted
215 or verified.
216
217 =item B<-inform SMIME|PEM|DER>
218
219 This specifies the input format for the CMS structure. The default
220 is B<SMIME> which reads an S/MIME format message. B<PEM> and B<DER>
221 format change this to expect PEM and DER format CMS structures
222 instead. This currently only affects the input format of the CMS
223 structure, if no CMS structure is being input (for example with
224 B<-encrypt> or B<-sign>) this option has no effect.
225
226 =item B<-rctform SMIME|PEM|DER>
227
228 Specify the format for a signed receipt for use with the B<-receipt_verify>
229 operation.
230
231 =item B<-out filename>
232
233 The message text that has been decrypted or verified or the output MIME
234 format message that has been signed or verified.
235
236 =item B<-outform SMIME|PEM|DER>
237
238 This specifies the output format for the CMS structure. The default
239 is B<SMIME> which writes an S/MIME format message. B<PEM> and B<DER>
240 format change this to write PEM and DER format CMS structures
241 instead. This currently only affects the output format of the CMS
242 structure, if no CMS structure is being output (for example with
243 B<-verify> or B<-decrypt>) this option has no effect.
244
245 =item B<-stream -indef -noindef>
246
247 The B<-stream> and B<-indef> options are equivalent and enable streaming I/O
248 for encoding operations. This permits single pass processing of data without
249 the need to hold the entire contents in memory, potentially supporting very
250 large files. Streaming is automatically set for S/MIME signing with detached
251 data if the output format is B<SMIME> it is currently off by default for all
252 other operations.
253
254 =item B<-noindef>
255
256 Disable streaming I/O where it would produce and indefinite length constructed
257 encoding. This option currently has no effect. In future streaming will be
258 enabled by default on all relevant operations and this option will disable it.
259
260 =item B<-content filename>
261
262 This specifies a file containing the detached content, this is only
263 useful with the B<-verify> command. This is only usable if the CMS
264 structure is using the detached signature form where the content is
265 not included. This option will override any content if the input format
266 is S/MIME and it uses the multipart/signed MIME content type.
267
268 =item B<-text>
269
270 This option adds plain text (text/plain) MIME headers to the supplied
271 message if encrypting or signing. If decrypting or verifying it strips
272 off text headers: if the decrypted or verified message is not of MIME
273 type text/plain then an error occurs.
274
275 =item B<-noout>
276
277 For the B<-cmsout> operation do not output the parsed CMS structure. This
278 is useful when combined with the B<-print> option or if the syntax of the CMS
279 structure is being checked.
280
281 =item B<-print>
282
283 For the B<-cmsout> operation print out all fields of the CMS structure. This
284 is mainly useful for testing purposes.
285
286 =item B<-CAfile file>
287
288 A file containing trusted CA certificates, only used with B<-verify>.
289
290 =item B<-CApath dir>
291
292 A directory containing trusted CA certificates, only used with
293 B<-verify>. This directory must be a standard certificate directory: that
294 is a hash of each subject name (using B<x509 -hash>) should be linked
295 to each certificate.
296
297 =item B<-no-CAfile>
298
299 Do not load the trusted CA certificates from the default file location
300
301 =item B<-no-CApath>
302
303 Do not load the trusted CA certificates from the default directory location
304
305 =item B<-md digest>
306
307 Digest algorithm to use when signing or resigning. If not present then the
308 default digest algorithm for the signing key will be used (usually SHA1).
309
310 =item B<-I<cipher>>
311
312 The encryption algorithm to use. For example triple DES (168 bits) - B<-des3>
313 or 256 bit AES - B<-aes256>. Any standard algorithm name (as used by the
314 EVP_get_cipherbyname() function) can also be used preceded by a dash, for
315 example B<-aes-128-cbc>. See L<enc(1)> for a list of ciphers
316 supported by your version of OpenSSL.
317
318 If not specified triple DES is used. Only used with B<-encrypt> and
319 B<-EncryptedData_create> commands.
320
321 =item B<-nointern>
322
323 When verifying a message normally certificates (if any) included in
324 the message are searched for the signing certificate. With this option
325 only the certificates specified in the B<-certfile> option are used.
326 The supplied certificates can still be used as untrusted CAs however.
327
328 =item B<-noverify>
329
330 Do not verify the signers certificate of a signed message.
331
332 =item B<-nocerts>
333
334 When signing a message the signer's certificate is normally included
335 with this option it is excluded. This will reduce the size of the
336 signed message but the verifier must have a copy of the signers certificate
337 available locally (passed using the B<-certfile> option for example).
338
339 =item B<-noattr>
340
341 Normally when a message is signed a set of attributes are included which
342 include the signing time and supported symmetric algorithms. With this
343 option they are not included.
344
345 =item B<-nosmimecap>
346
347 Exclude the list of supported algorithms from signed attributes, other options
348 such as signing time and content type are still included.
349
350 =item B<-binary>
351
352 Normally the input message is converted to "canonical" format which is
353 effectively using CR and LF as end of line: as required by the S/MIME
354 specification. When this option is present no translation occurs. This
355 is useful when handling binary data which may not be in MIME format.
356
357 =item B<-crlfeol>
358
359 Normally the output file uses a single B<LF> as end of line. When this
360 option is present B<CRLF> is used instead.
361
362 =item B<-asciicrlf>
363
364 When signing use ASCII CRLF format canonicalisation. This strips trailing
365 whitespace from all lines, deletes trailing blank lines at EOF and sets
366 the encapsulated content type. This option is normally used with detached
367 content and an output signature format of DER. This option is not normally
368 needed when verifying as it is enabled automatically if the encapsulated
369 content format is detected.
370
371 =item B<-nodetach>
372
373 When signing a message use opaque signing: this form is more resistant
374 to translation by mail relays but it cannot be read by mail agents that
375 do not support S/MIME.  Without this option cleartext signing with
376 the MIME type multipart/signed is used.
377
378 =item B<-certfile file>
379
380 Allows additional certificates to be specified. When signing these will
381 be included with the message. When verifying these will be searched for
382 the signers certificates. The certificates should be in PEM format.
383
384 =item B<-certsout file>
385
386 Any certificates contained in the message are written to B<file>.
387
388 =item B<-signer file>
389
390 A signing certificate when signing or resigning a message, this option can be
391 used multiple times if more than one signer is required. If a message is being
392 verified then the signers certificates will be written to this file if the
393 verification was successful.
394
395 =item B<-recip file>
396
397 When decrypting a message this specifies the recipients certificate. The
398 certificate must match one of the recipients of the message or an error
399 occurs.
400
401 When encrypting a message this option may be used multiple times to specify
402 each recipient. This form B<must> be used if customised parameters are
403 required (for example to specify RSA-OAEP).
404
405 Only certificates carrying RSA, Diffie-Hellman or EC keys are supported by this
406 option.
407
408 =item B<-keyid>
409
410 Use subject key identifier to identify certificates instead of issuer name and
411 serial number. The supplied certificate B<must> include a subject key
412 identifier extension. Supported by B<-sign> and B<-encrypt> options.
413
414 =item B<-receipt_request_all>, B<-receipt_request_first>
415
416 For B<-sign> option include a signed receipt request. Indicate requests should
417 be provided by all recipient or first tier recipients (those mailed directly
418 and not from a mailing list). Ignored it B<-receipt_request_from> is included.
419
420 =item B<-receipt_request_from emailaddress>
421
422 For B<-sign> option include a signed receipt request. Add an explicit email
423 address where receipts should be supplied.
424
425 =item B<-receipt_request_to emailaddress>
426
427 Add an explicit email address where signed receipts should be sent to. This
428 option B<must> but supplied if a signed receipt it requested.
429
430 =item B<-receipt_request_print>
431
432 For the B<-verify> operation print out the contents of any signed receipt
433 requests.
434
435 =item B<-secretkey key>
436
437 Specify symmetric key to use. The key must be supplied in hex format and be
438 consistent with the algorithm used. Supported by the B<-EncryptedData_encrypt>
439 B<-EncryptedData_decrypt>, B<-encrypt> and B<-decrypt> options. When used
440 with B<-encrypt> or B<-decrypt> the supplied key is used to wrap or unwrap the
441 content encryption key using an AES key in the B<KEKRecipientInfo> type.
442
443 =item B<-secretkeyid id>
444
445 The key identifier for the supplied symmetric key for B<KEKRecipientInfo> type.
446 This option B<must> be present if the B<-secretkey> option is used with
447 B<-encrypt>. With B<-decrypt> operations the B<id> is used to locate the
448 relevant key if it is not supplied then an attempt is used to decrypt any
449 B<KEKRecipientInfo> structures.
450
451 =item B<-econtent_type type>
452
453 Set the encapsulated content type to B<type> if not supplied the B<Data> type
454 is used. The B<type> argument can be any valid OID name in either text or
455 numerical format.
456
457 =item B<-inkey file>
458
459 The private key to use when signing or decrypting. This must match the
460 corresponding certificate. If this option is not specified then the
461 private key must be included in the certificate file specified with
462 the B<-recip> or B<-signer> file. When signing this option can be used
463 multiple times to specify successive keys.
464
465 =item B<-keyopt name:opt>
466
467 For signing and encryption this option can be used multiple times to
468 set customised parameters for the preceding key or certificate. It can
469 currently be used to set RSA-PSS for signing, RSA-OAEP for encryption
470 or to modify default parameters for ECDH.
471
472 =item B<-passin arg>
473
474 The private key password source. For more information about the format of B<arg>
475 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
476
477 =item B<-rand file...>
478
479 A file or files containing random data used to seed the random number
480 generator.
481 Multiple files can be specified separated by an OS-dependent character.
482 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
483 all others.
484
485 =item [B<-writerand file>]
486
487 Writes random data to the specified I<file> upon exit.
488 This can be used with a subsequent B<-rand> flag.
489
490 =item B<cert.pem...>
491
492 One or more certificates of message recipients: used when encrypting
493 a message.
494
495 =item B<-to, -from, -subject>
496
497 The relevant mail headers. These are included outside the signed
498 portion of a message so they may be included manually. If signing
499 then many S/MIME mail clients check the signers certificate's email
500 address matches that specified in the From: address.
501
502 =item B<-attime>, B<-check_ss_sig>, B<-crl_check>, B<-crl_check_all>,
503 B<-explicit_policy>, B<-extended_crl>, B<-ignore_critical>, B<-inhibit_any>,
504 B<-inhibit_map>, B<-no_alt_chains>, B<-no_check_time>, B<-partial_chain>, B<-policy>,
505 B<-policy_check>, B<-policy_print>, B<-purpose>, B<-suiteB_128>,
506 B<-suiteB_128_only>, B<-suiteB_192>, B<-trusted_first>, B<-use_deltas>,
507 B<-auth_level>, B<-verify_depth>, B<-verify_email>, B<-verify_hostname>,
508 B<-verify_ip>, B<-verify_name>, B<-x509_strict>
509
510 Set various certificate chain validation options. See the
511 L<verify(1)> manual page for details.
512
513 =back
514
515 =head1 NOTES
516
517 The MIME message must be sent without any blank lines between the
518 headers and the output. Some mail programs will automatically add
519 a blank line. Piping the mail directly to sendmail is one way to
520 achieve the correct format.
521
522 The supplied message to be signed or encrypted must include the
523 necessary MIME headers or many S/MIME clients won't display it
524 properly (if at all). You can use the B<-text> option to automatically
525 add plain text headers.
526
527 A "signed and encrypted" message is one where a signed message is
528 then encrypted. This can be produced by encrypting an already signed
529 message: see the examples section.
530
531 This version of the program only allows one signer per message but it
532 will verify multiple signers on received messages. Some S/MIME clients
533 choke if a message contains multiple signers. It is possible to sign
534 messages "in parallel" by signing an already signed message.
535
536 The options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME
537 clients. Strictly speaking these process CMS enveloped data: CMS
538 encrypted data is used for other purposes.
539
540 The B<-resign> option uses an existing message digest when adding a new
541 signer. This means that attributes must be present in at least one existing
542 signer using the same message digest or this operation will fail.
543
544 The B<-stream> and B<-indef> options enable streaming I/O support.
545 As a result the encoding is BER using indefinite length constructed encoding
546 and no longer DER. Streaming is supported for the B<-encrypt> operation and the
547 B<-sign> operation if the content is not detached.
548
549 Streaming is always used for the B<-sign> operation with detached data but
550 since the content is no longer part of the CMS structure the encoding
551 remains DER.
552
553 If the B<-decrypt> option is used without a recipient certificate then an
554 attempt is made to locate the recipient by trying each potential recipient
555 in turn using the supplied private key. To thwart the MMA attack
556 (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all recipients are
557 tried whether they succeed or not and if no recipients match the message
558 is "decrypted" using a random key which will typically output garbage.
559 The B<-debug_decrypt> option can be used to disable the MMA attack protection
560 and return an error if no recipient can be found: this option should be used
561 with caution. For a fuller description see L<CMS_decrypt(3)>).
562
563 =head1 CAdES Basic Electronic Signature (CAdES-BES)
564
565 A CAdES Basic Electronic Signature (CAdES-BES), as defined in the European Standard ETSI EN 319 122-1 V1.1.1, contains:
566
567 =over 4
568
569 =item *
570
571 The signed user data as defined in CMS (RFC 3852);
572
573 =item *
574
575 Content-type of the EncapsulatedContentInfo value being signed;
576
577 =item *
578
579 Message-digest of the eContent OCTET STRING within encapContentInfo being signed;
580
581 =item *
582
583 An ESS signing-certificate or ESS signing-certificate-v2 attribute, as defined in Enhanced Security Services (ESS), RFC 2634 and RFC 5035.
584 An ESS signing-certificate attribute only allows for the use of SHA-1 as a digest algorithm.
585 An ESS signing-certificate-v2 attribute allows for the use of any digest algorithm.
586
587 =item *
588
589 The digital signature value computed on the user data and, when present, on the signed attributes.
590
591 Note that currently the B<-cades> option applies only to the B<-sign> operation and is ignored during
592 the B<-verify> operation, i.e. the signing certification is not checked during the verification process.
593 This feature might be added in a future version.
594
595 =back
596
597 =head1 EXIT CODES
598
599 =over 4
600
601 =item Z<>0
602
603 The operation was completely successfully.
604
605 =item Z<>1
606
607 An error occurred parsing the command options.
608
609 =item Z<>2
610
611 One of the input files could not be read.
612
613 =item Z<>3
614
615 An error occurred creating the CMS file or when reading the MIME
616 message.
617
618 =item Z<>4
619
620 An error occurred decrypting or verifying the message.
621
622 =item Z<>5
623
624 The message was verified correctly but an error occurred writing out
625 the signers certificates.
626
627 =back
628
629 =head1 COMPATIBILITY WITH PKCS#7 format.
630
631 The B<smime> utility can only process the older B<PKCS#7> format. The B<cms>
632 utility supports Cryptographic Message Syntax format. Use of some features
633 will result in messages which cannot be processed by applications which only
634 support the older format. These are detailed below.
635
636 The use of the B<-keyid> option with B<-sign> or B<-encrypt>.
637
638 The B<-outform PEM> option uses different headers.
639
640 The B<-compress> option.
641
642 The B<-secretkey> option when used with B<-encrypt>.
643
644 The use of PSS with B<-sign>.
645
646 The use of OAEP or non-RSA keys with B<-encrypt>.
647
648 Additionally the B<-EncryptedData_create> and B<-data_create> type cannot
649 be processed by the older B<smime> command.
650
651 =head1 EXAMPLES
652
653 Create a cleartext signed message:
654
655  openssl cms -sign -in message.txt -text -out mail.msg \
656         -signer mycert.pem
657
658 Create an opaque signed message
659
660  openssl cms -sign -in message.txt -text -out mail.msg -nodetach \
661         -signer mycert.pem
662
663 Create a signed message, include some additional certificates and
664 read the private key from another file:
665
666  openssl cms -sign -in in.txt -text -out mail.msg \
667         -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem
668
669 Create a signed message with two signers, use key identifier:
670
671  openssl cms -sign -in message.txt -text -out mail.msg \
672         -signer mycert.pem -signer othercert.pem -keyid
673
674 Send a signed message under Unix directly to sendmail, including headers:
675
676  openssl cms -sign -in in.txt -text -signer mycert.pem \
677         -from steve@openssl.org -to someone@somewhere \
678         -subject "Signed message" | sendmail someone@somewhere
679
680 Verify a message and extract the signer's certificate if successful:
681
682  openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt
683
684 Send encrypted mail using triple DES:
685
686  openssl cms -encrypt -in in.txt -from steve@openssl.org \
687         -to someone@somewhere -subject "Encrypted message" \
688         -des3 user.pem -out mail.msg
689
690 Sign and encrypt mail:
691
692  openssl cms -sign -in ml.txt -signer my.pem -text \
693         | openssl cms -encrypt -out mail.msg \
694         -from steve@openssl.org -to someone@somewhere \
695         -subject "Signed and Encrypted message" -des3 user.pem
696
697 Note: the encryption command does not include the B<-text> option because the
698 message being encrypted already has MIME headers.
699
700 Decrypt mail:
701
702  openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem
703
704 The output from Netscape form signing is a PKCS#7 structure with the
705 detached signature format. You can use this program to verify the
706 signature by line wrapping the base64 encoded structure and surrounding
707 it with:
708
709  -----BEGIN PKCS7-----
710  -----END PKCS7-----
711
712 and using the command,
713
714  openssl cms -verify -inform PEM -in signature.pem -content content.txt
715
716 alternatively you can base64 decode the signature and use
717
718  openssl cms -verify -inform DER -in signature.der -content content.txt
719
720 Create an encrypted message using 128 bit Camellia:
721
722  openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem
723
724 Add a signer to an existing message:
725
726  openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg
727
728 Sign mail using RSA-PSS:
729
730  openssl cms -sign -in message.txt -text -out mail.msg \
731         -signer mycert.pem -keyopt rsa_padding_mode:pss
732
733 Create encrypted mail using RSA-OAEP:
734
735  openssl cms -encrypt -in plain.txt -out mail.msg \
736         -recip cert.pem -keyopt rsa_padding_mode:oaep
737
738 Use SHA256 KDF with an ECDH certificate:
739
740  openssl cms -encrypt -in plain.txt -out mail.msg \
741         -recip ecdhcert.pem -keyopt ecdh_kdf_md:sha256
742
743 =head1 BUGS
744
745 The MIME parser isn't very clever: it seems to handle most messages that I've
746 thrown at it but it may choke on others.
747
748 The code currently will only write out the signer's certificate to a file: if
749 the signer has a separate encryption certificate this must be manually
750 extracted. There should be some heuristic that determines the correct
751 encryption certificate.
752
753 Ideally a database should be maintained of a certificates for each email
754 address.
755
756 The code doesn't currently take note of the permitted symmetric encryption
757 algorithms as supplied in the SMIMECapabilities signed attribute. this means the
758 user has to manually include the correct encryption algorithm. It should store
759 the list of permitted ciphers in a database and only use those.
760
761 No revocation checking is done on the signer's certificate.
762
763 =head1 HISTORY
764
765 The use of multiple B<-signer> options and the B<-resign> command were first
766 added in OpenSSL 1.0.0.
767
768 The B<keyopt> option was added in OpenSSL 1.0.2.
769
770 Support for RSA-OAEP and RSA-PSS was added in OpenSSL 1.0.2.
771
772 The use of non-RSA keys with B<-encrypt> and B<-decrypt>
773 was added in OpenSSL 1.0.2.
774
775 The -no_alt_chains option was added in OpenSSL 1.0.2b.
776
777 =head1 COPYRIGHT
778
779 Copyright 2008-2018 The OpenSSL Project Authors. All Rights Reserved.
780
781 Licensed under the Apache License 2.0 (the "License").  You may not use
782 this file except in compliance with the License.  You can obtain a copy
783 in the file LICENSE in the source distribution or at
784 L<https://www.openssl.org/source/license.html>.
785
786 =cut