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