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