1*b077aed3SPierre Pronchery=pod 2*b077aed3SPierre Pronchery{- OpenSSL::safe::output_do_not_edit_headers(); -} 3*b077aed3SPierre Pronchery 4*b077aed3SPierre Pronchery=head1 NAME 5*b077aed3SPierre Pronchery 6*b077aed3SPierre Proncheryopenssl-cms - CMS command 7*b077aed3SPierre Pronchery 8*b077aed3SPierre Pronchery=head1 SYNOPSIS 9*b077aed3SPierre Pronchery 10*b077aed3SPierre ProncheryB<openssl> B<cms> 11*b077aed3SPierre Pronchery[B<-help>] 12*b077aed3SPierre Pronchery 13*b077aed3SPierre ProncheryGeneral options: 14*b077aed3SPierre Pronchery 15*b077aed3SPierre Pronchery[B<-in> I<filename>] 16*b077aed3SPierre Pronchery[B<-out> I<filename>] 17*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_config_synopsis -} 18*b077aed3SPierre Pronchery 19*b077aed3SPierre ProncheryOperation options: 20*b077aed3SPierre Pronchery 21*b077aed3SPierre Pronchery[B<-encrypt>] 22*b077aed3SPierre Pronchery[B<-decrypt>] 23*b077aed3SPierre Pronchery[B<-sign>] 24*b077aed3SPierre Pronchery[B<-verify>] 25*b077aed3SPierre Pronchery[B<-resign>] 26*b077aed3SPierre Pronchery[B<-sign_receipt>] 27*b077aed3SPierre Pronchery[B<-verify_receipt> I<receipt>] 28*b077aed3SPierre Pronchery[B<-digest_create>] 29*b077aed3SPierre Pronchery[B<-digest_verify>] 30*b077aed3SPierre Pronchery[B<-compress>] 31*b077aed3SPierre Pronchery[B<-uncompress>] 32*b077aed3SPierre Pronchery[B<-EncryptedData_encrypt>] 33*b077aed3SPierre Pronchery[B<-EncryptedData_decrypt>] 34*b077aed3SPierre Pronchery[B<-data_create>] 35*b077aed3SPierre Pronchery[B<-data_out>] 36*b077aed3SPierre Pronchery[B<-cmsout>] 37*b077aed3SPierre Pronchery 38*b077aed3SPierre ProncheryFile format options: 39*b077aed3SPierre Pronchery 40*b077aed3SPierre Pronchery[B<-inform> B<DER>|B<PEM>|B<SMIME>] 41*b077aed3SPierre Pronchery[B<-outform> B<DER>|B<PEM>|B<SMIME>] 42*b077aed3SPierre Pronchery[B<-rctform> B<DER>|B<PEM>|B<SMIME>] 43*b077aed3SPierre Pronchery[B<-stream>] 44*b077aed3SPierre Pronchery[B<-indef>] 45*b077aed3SPierre Pronchery[B<-noindef>] 46*b077aed3SPierre Pronchery[B<-binary>] 47*b077aed3SPierre Pronchery[B<-crlfeol>] 48*b077aed3SPierre Pronchery[B<-asciicrlf>] 49*b077aed3SPierre Pronchery 50*b077aed3SPierre ProncheryKeys and password options: 51*b077aed3SPierre Pronchery 52*b077aed3SPierre Pronchery[B<-pwri_password> I<password>] 53*b077aed3SPierre Pronchery[B<-secretkey> I<key>] 54*b077aed3SPierre Pronchery[B<-secretkeyid> I<id>] 55*b077aed3SPierre Pronchery[B<-inkey> I<filename>|I<uri>] 56*b077aed3SPierre Pronchery[B<-passin> I<arg>] 57*b077aed3SPierre Pronchery[B<-keyopt> I<name>:I<parameter>] 58*b077aed3SPierre Pronchery[B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>] 59*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -} 60*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_r_synopsis -} 61*b077aed3SPierre Pronchery 62*b077aed3SPierre ProncheryEncryption options: 63*b077aed3SPierre Pronchery 64*b077aed3SPierre Pronchery[B<-originator> I<file>] 65*b077aed3SPierre Pronchery[B<-recip> I<file>] 66*b077aed3SPierre Pronchery[I<recipient-cert> ...] 67*b077aed3SPierre Pronchery[B<-I<cipher>>] 68*b077aed3SPierre Pronchery[B<-wrap> I<cipher>] 69*b077aed3SPierre Pronchery[B<-aes128-wrap>] 70*b077aed3SPierre Pronchery[B<-aes192-wrap>] 71*b077aed3SPierre Pronchery[B<-aes256-wrap>] 72*b077aed3SPierre Pronchery[B<-des3-wrap>] 73*b077aed3SPierre Pronchery[B<-debug_decrypt>] 74*b077aed3SPierre Pronchery 75*b077aed3SPierre ProncherySigning options: 76*b077aed3SPierre Pronchery 77*b077aed3SPierre Pronchery[B<-md> I<digest>] 78*b077aed3SPierre Pronchery[B<-signer> I<file>] 79*b077aed3SPierre Pronchery[B<-certfile> I<file>] 80*b077aed3SPierre Pronchery[B<-cades>] 81*b077aed3SPierre Pronchery[B<-nodetach>] 82*b077aed3SPierre Pronchery[B<-nocerts>] 83*b077aed3SPierre Pronchery[B<-noattr>] 84*b077aed3SPierre Pronchery[B<-nosmimecap>] 85*b077aed3SPierre Pronchery[B<-receipt_request_all>] 86*b077aed3SPierre Pronchery[B<-receipt_request_first>] 87*b077aed3SPierre Pronchery[B<-receipt_request_from> I<emailaddress>] 88*b077aed3SPierre Pronchery[B<-receipt_request_to> I<emailaddress>] 89*b077aed3SPierre Pronchery 90*b077aed3SPierre ProncheryVerification options: 91*b077aed3SPierre Pronchery 92*b077aed3SPierre Pronchery[B<-signer> I<file>] 93*b077aed3SPierre Pronchery[B<-content> I<filename>] 94*b077aed3SPierre Pronchery[B<-no_content_verify>] 95*b077aed3SPierre Pronchery[B<-no_attr_verify>] 96*b077aed3SPierre Pronchery[B<-nosigs>] 97*b077aed3SPierre Pronchery[B<-noverify>] 98*b077aed3SPierre Pronchery[B<-nointern>] 99*b077aed3SPierre Pronchery[B<-cades>] 100*b077aed3SPierre Pronchery[B<-verify_retcode>] 101*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_trust_synopsis -} 102*b077aed3SPierre Pronchery 103*b077aed3SPierre ProncheryOutput options: 104*b077aed3SPierre Pronchery 105*b077aed3SPierre Pronchery[B<-keyid>] 106*b077aed3SPierre Pronchery[B<-econtent_type> I<type>] 107*b077aed3SPierre Pronchery[B<-text>] 108*b077aed3SPierre Pronchery[B<-certsout> I<file>] 109*b077aed3SPierre Pronchery[B<-to> I<addr>] 110*b077aed3SPierre Pronchery[B<-from> I<addr>] 111*b077aed3SPierre Pronchery[B<-subject> I<subj>] 112*b077aed3SPierre Pronchery 113*b077aed3SPierre ProncheryPrinting options: 114*b077aed3SPierre Pronchery 115*b077aed3SPierre Pronchery[B<-noout>] 116*b077aed3SPierre Pronchery[B<-print>] 117*b077aed3SPierre Pronchery[B<-nameopt> I<option>] 118*b077aed3SPierre Pronchery[B<-receipt_request_print>] 119*b077aed3SPierre Pronchery 120*b077aed3SPierre ProncheryValidation options: 121*b077aed3SPierre Pronchery 122*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_v_synopsis -} 123*b077aed3SPierre Pronchery 124*b077aed3SPierre Pronchery=head1 DESCRIPTION 125*b077aed3SPierre Pronchery 126*b077aed3SPierre ProncheryThis command handles data in CMS format such as S/MIME v3.1 email messages. 127*b077aed3SPierre ProncheryIt can encrypt, decrypt, sign, verify, compress, uncompress, and print messages. 128*b077aed3SPierre Pronchery 129*b077aed3SPierre Pronchery=head1 OPTIONS 130*b077aed3SPierre Pronchery 131*b077aed3SPierre ProncheryThere are a number of operation options that set the type of operation to be 132*b077aed3SPierre Proncheryperformed: encrypt, decrypt, sign, verify, resign, sign_receipt, verify_receipt, 133*b077aed3SPierre Proncherydigest_create, digest_verify, compress, uncompress, 134*b077aed3SPierre ProncheryEncryptedData_encrypt, EncryptedData_decrypt, data_create, data_out, or cmsout. 135*b077aed3SPierre ProncheryThe relevance of the other options depends on the operation type 136*b077aed3SPierre Proncheryand their meaning may vary according to it. 137*b077aed3SPierre Pronchery 138*b077aed3SPierre Pronchery=over 4 139*b077aed3SPierre Pronchery 140*b077aed3SPierre Pronchery=item B<-help> 141*b077aed3SPierre Pronchery 142*b077aed3SPierre ProncheryPrint out a usage message. 143*b077aed3SPierre Pronchery 144*b077aed3SPierre Pronchery=back 145*b077aed3SPierre Pronchery 146*b077aed3SPierre Pronchery=head2 General options 147*b077aed3SPierre Pronchery 148*b077aed3SPierre Pronchery=over 4 149*b077aed3SPierre Pronchery 150*b077aed3SPierre Pronchery=item B<-in> I<filename> 151*b077aed3SPierre Pronchery 152*b077aed3SPierre ProncheryThe input message to be encrypted or signed or the message to be decrypted 153*b077aed3SPierre Proncheryor verified. 154*b077aed3SPierre Pronchery 155*b077aed3SPierre Pronchery=item B<-out> I<filename> 156*b077aed3SPierre Pronchery 157*b077aed3SPierre ProncheryThe message text that has been decrypted or verified or the output MIME 158*b077aed3SPierre Proncheryformat message that has been signed or verified. 159*b077aed3SPierre Pronchery 160*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_config_item -} 161*b077aed3SPierre Pronchery 162*b077aed3SPierre Pronchery=back 163*b077aed3SPierre Pronchery 164*b077aed3SPierre Pronchery=head2 Operation options 165*b077aed3SPierre Pronchery 166*b077aed3SPierre Pronchery=over 4 167*b077aed3SPierre Pronchery 168*b077aed3SPierre Pronchery=item B<-encrypt> 169*b077aed3SPierre Pronchery 170*b077aed3SPierre ProncheryEncrypt data for the given recipient certificates. Input file is the message 171*b077aed3SPierre Proncheryto be encrypted. The output file is the encrypted data in MIME format. The 172*b077aed3SPierre Proncheryactual CMS type is B<EnvelopedData>. 173*b077aed3SPierre Pronchery 174*b077aed3SPierre ProncheryNote that no revocation check is done for the recipient cert, so if that 175*b077aed3SPierre Proncherykey has been compromised, others may be able to decrypt the text. 176*b077aed3SPierre Pronchery 177*b077aed3SPierre Pronchery=item B<-decrypt> 178*b077aed3SPierre Pronchery 179*b077aed3SPierre ProncheryDecrypt data using the supplied certificate and private key. Expects 180*b077aed3SPierre Proncheryencrypted datain MIME format for the input file. The decrypted data 181*b077aed3SPierre Proncheryis written to the output file. 182*b077aed3SPierre Pronchery 183*b077aed3SPierre Pronchery=item B<-sign> 184*b077aed3SPierre Pronchery 185*b077aed3SPierre ProncherySign data using the supplied certificate and private key. Input file is 186*b077aed3SPierre Proncherythe message to be signed. The signed data in MIME format is written 187*b077aed3SPierre Proncheryto the output file. 188*b077aed3SPierre Pronchery 189*b077aed3SPierre Pronchery=item B<-verify> 190*b077aed3SPierre Pronchery 191*b077aed3SPierre ProncheryVerify signed data. Expects a signed data on input and outputs 192*b077aed3SPierre Proncherythe signed data. Both clear text and opaque signing is supported. 193*b077aed3SPierre Pronchery 194*b077aed3SPierre Pronchery=item B<-resign> 195*b077aed3SPierre Pronchery 196*b077aed3SPierre ProncheryResign a message: take an existing message and one or more new signers. 197*b077aed3SPierre Pronchery 198*b077aed3SPierre Pronchery=item B<-sign_receipt> 199*b077aed3SPierre Pronchery 200*b077aed3SPierre ProncheryGenerate and output a signed receipt for the supplied message. The input 201*b077aed3SPierre Proncherymessage B<must> contain a signed receipt request. Functionality is otherwise 202*b077aed3SPierre Proncherysimilar to the B<-sign> operation. 203*b077aed3SPierre Pronchery 204*b077aed3SPierre Pronchery=item B<-verify_receipt> I<receipt> 205*b077aed3SPierre Pronchery 206*b077aed3SPierre ProncheryVerify a signed receipt in filename B<receipt>. The input message B<must> 207*b077aed3SPierre Proncherycontain the original receipt request. Functionality is otherwise similar 208*b077aed3SPierre Proncheryto the B<-verify> operation. 209*b077aed3SPierre Pronchery 210*b077aed3SPierre Pronchery=item B<-digest_create> 211*b077aed3SPierre Pronchery 212*b077aed3SPierre ProncheryCreate a CMS B<DigestedData> type. 213*b077aed3SPierre Pronchery 214*b077aed3SPierre Pronchery=item B<-digest_verify> 215*b077aed3SPierre Pronchery 216*b077aed3SPierre ProncheryVerify a CMS B<DigestedData> type and output the content. 217*b077aed3SPierre Pronchery 218*b077aed3SPierre Pronchery=item B<-compress> 219*b077aed3SPierre Pronchery 220*b077aed3SPierre ProncheryCreate a CMS B<CompressedData> type. OpenSSL must be compiled with B<zlib> 221*b077aed3SPierre Proncherysupport for this option to work, otherwise it will output an error. 222*b077aed3SPierre Pronchery 223*b077aed3SPierre Pronchery=item B<-uncompress> 224*b077aed3SPierre Pronchery 225*b077aed3SPierre ProncheryUncompress a CMS B<CompressedData> type and output the content. OpenSSL must be 226*b077aed3SPierre Proncherycompiled with B<zlib> support for this option to work, otherwise it will 227*b077aed3SPierre Proncheryoutput an error. 228*b077aed3SPierre Pronchery 229*b077aed3SPierre Pronchery=item B<-EncryptedData_encrypt> 230*b077aed3SPierre Pronchery 231*b077aed3SPierre ProncheryEncrypt content using supplied symmetric key and algorithm using a CMS 232*b077aed3SPierre ProncheryB<EncryptedData> type and output the content. 233*b077aed3SPierre Pronchery 234*b077aed3SPierre Pronchery=item B<-EncryptedData_decrypt> 235*b077aed3SPierre Pronchery 236*b077aed3SPierre ProncheryDecrypt content using supplied symmetric key and algorithm using a CMS 237*b077aed3SPierre ProncheryB<EncryptedData> type and output the content. 238*b077aed3SPierre Pronchery 239*b077aed3SPierre Pronchery=item B<-data_create> 240*b077aed3SPierre Pronchery 241*b077aed3SPierre ProncheryCreate a CMS B<Data> type. 242*b077aed3SPierre Pronchery 243*b077aed3SPierre Pronchery=item B<-data_out> 244*b077aed3SPierre Pronchery 245*b077aed3SPierre ProncheryB<Data> type and output the content. 246*b077aed3SPierre Pronchery 247*b077aed3SPierre Pronchery=item B<-cmsout> 248*b077aed3SPierre Pronchery 249*b077aed3SPierre ProncheryTakes an input message and writes out a PEM encoded CMS structure. 250*b077aed3SPierre Pronchery 251*b077aed3SPierre Pronchery=back 252*b077aed3SPierre Pronchery 253*b077aed3SPierre Pronchery=head2 File format options 254*b077aed3SPierre Pronchery 255*b077aed3SPierre Pronchery=over 4 256*b077aed3SPierre Pronchery 257*b077aed3SPierre Pronchery=item B<-inform> B<DER>|B<PEM>|B<SMIME> 258*b077aed3SPierre Pronchery 259*b077aed3SPierre ProncheryThe input format of the CMS structure (if one is being read); 260*b077aed3SPierre Proncherythe default is B<SMIME>. 261*b077aed3SPierre ProncherySee L<openssl-format-options(1)> for details. 262*b077aed3SPierre Pronchery 263*b077aed3SPierre Pronchery=item B<-outform> B<DER>|B<PEM>|B<SMIME> 264*b077aed3SPierre Pronchery 265*b077aed3SPierre ProncheryThe output format of the CMS structure (if one is being written); 266*b077aed3SPierre Proncherythe default is B<SMIME>. 267*b077aed3SPierre ProncherySee L<openssl-format-options(1)> for details. 268*b077aed3SPierre Pronchery 269*b077aed3SPierre Pronchery=item B<-rctform> B<DER>|B<PEM>|B<SMIME> 270*b077aed3SPierre Pronchery 271*b077aed3SPierre ProncheryThe signed receipt format for use with the B<-receipt_verify>; the default 272*b077aed3SPierre Proncheryis B<SMIME>. 273*b077aed3SPierre ProncherySee L<openssl-format-options(1)> for details. 274*b077aed3SPierre Pronchery 275*b077aed3SPierre Pronchery=item B<-stream>, B<-indef> 276*b077aed3SPierre Pronchery 277*b077aed3SPierre ProncheryThe B<-stream> and B<-indef> options are equivalent and enable streaming I/O 278*b077aed3SPierre Proncheryfor encoding operations. This permits single pass processing of data without 279*b077aed3SPierre Proncherythe need to hold the entire contents in memory, potentially supporting very 280*b077aed3SPierre Proncherylarge files. Streaming is automatically set for S/MIME signing with detached 281*b077aed3SPierre Proncherydata if the output format is B<SMIME> it is currently off by default for all 282*b077aed3SPierre Proncheryother operations. 283*b077aed3SPierre Pronchery 284*b077aed3SPierre Pronchery=item B<-noindef> 285*b077aed3SPierre Pronchery 286*b077aed3SPierre ProncheryDisable streaming I/O where it would produce and indefinite length constructed 287*b077aed3SPierre Proncheryencoding. This option currently has no effect. In future streaming will be 288*b077aed3SPierre Proncheryenabled by default on all relevant operations and this option will disable it. 289*b077aed3SPierre Pronchery 290*b077aed3SPierre Pronchery=item B<-binary> 291*b077aed3SPierre Pronchery 292*b077aed3SPierre ProncheryNormally the input message is converted to "canonical" format which is 293*b077aed3SPierre Proncheryeffectively using CR and LF as end of line: as required by the S/MIME 294*b077aed3SPierre Proncheryspecification. When this option is present no translation occurs. This 295*b077aed3SPierre Proncheryis useful when handling binary data which may not be in MIME format. 296*b077aed3SPierre Pronchery 297*b077aed3SPierre Pronchery=item B<-crlfeol> 298*b077aed3SPierre Pronchery 299*b077aed3SPierre ProncheryNormally the output file uses a single B<LF> as end of line. When this 300*b077aed3SPierre Proncheryoption is present B<CRLF> is used instead. 301*b077aed3SPierre Pronchery 302*b077aed3SPierre Pronchery=item B<-asciicrlf> 303*b077aed3SPierre Pronchery 304*b077aed3SPierre ProncheryWhen signing use ASCII CRLF format canonicalisation. This strips trailing 305*b077aed3SPierre Proncherywhitespace from all lines, deletes trailing blank lines at EOF and sets 306*b077aed3SPierre Proncherythe encapsulated content type. This option is normally used with detached 307*b077aed3SPierre Proncherycontent and an output signature format of DER. This option is not normally 308*b077aed3SPierre Proncheryneeded when verifying as it is enabled automatically if the encapsulated 309*b077aed3SPierre Proncherycontent format is detected. 310*b077aed3SPierre Pronchery 311*b077aed3SPierre Pronchery=back 312*b077aed3SPierre Pronchery 313*b077aed3SPierre Pronchery=head2 Keys and password options 314*b077aed3SPierre Pronchery 315*b077aed3SPierre Pronchery=over 4 316*b077aed3SPierre Pronchery 317*b077aed3SPierre Pronchery=item B<-pwri_password> I<password> 318*b077aed3SPierre Pronchery 319*b077aed3SPierre ProncherySpecify password for recipient. 320*b077aed3SPierre Pronchery 321*b077aed3SPierre Pronchery=item B<-secretkey> I<key> 322*b077aed3SPierre Pronchery 323*b077aed3SPierre ProncherySpecify symmetric key to use. The key must be supplied in hex format and be 324*b077aed3SPierre Proncheryconsistent with the algorithm used. Supported by the B<-EncryptedData_encrypt> 325*b077aed3SPierre ProncheryB<-EncryptedData_decrypt>, B<-encrypt> and B<-decrypt> options. When used 326*b077aed3SPierre Proncherywith B<-encrypt> or B<-decrypt> the supplied key is used to wrap or unwrap the 327*b077aed3SPierre Proncherycontent encryption key using an AES key in the B<KEKRecipientInfo> type. 328*b077aed3SPierre Pronchery 329*b077aed3SPierre Pronchery=item B<-secretkeyid> I<id> 330*b077aed3SPierre Pronchery 331*b077aed3SPierre ProncheryThe key identifier for the supplied symmetric key for B<KEKRecipientInfo> type. 332*b077aed3SPierre ProncheryThis option B<must> be present if the B<-secretkey> option is used with 333*b077aed3SPierre ProncheryB<-encrypt>. With B<-decrypt> operations the I<id> is used to locate the 334*b077aed3SPierre Proncheryrelevant key if it is not supplied then an attempt is used to decrypt any 335*b077aed3SPierre ProncheryB<KEKRecipientInfo> structures. 336*b077aed3SPierre Pronchery 337*b077aed3SPierre Pronchery=item B<-inkey> I<filename>|I<uri> 338*b077aed3SPierre Pronchery 339*b077aed3SPierre ProncheryThe private key to use when signing or decrypting. This must match the 340*b077aed3SPierre Proncherycorresponding certificate. If this option is not specified then the 341*b077aed3SPierre Proncheryprivate key must be included in the certificate file specified with 342*b077aed3SPierre Proncherythe B<-recip> or B<-signer> file. When signing this option can be used 343*b077aed3SPierre Proncherymultiple times to specify successive keys. 344*b077aed3SPierre Pronchery 345*b077aed3SPierre Pronchery=item B<-passin> I<arg> 346*b077aed3SPierre Pronchery 347*b077aed3SPierre ProncheryThe private key password source. For more information about the format of B<arg> 348*b077aed3SPierre Proncherysee L<openssl-passphrase-options(1)>. 349*b077aed3SPierre Pronchery 350*b077aed3SPierre Pronchery=item B<-keyopt> I<name>:I<parameter> 351*b077aed3SPierre Pronchery 352*b077aed3SPierre ProncheryFor signing and encryption this option can be used multiple times to 353*b077aed3SPierre Proncheryset customised parameters for the preceding key or certificate. It can 354*b077aed3SPierre Proncherycurrently be used to set RSA-PSS for signing, RSA-OAEP for encryption 355*b077aed3SPierre Proncheryor to modify default parameters for ECDH. 356*b077aed3SPierre Pronchery 357*b077aed3SPierre Pronchery=item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE> 358*b077aed3SPierre Pronchery 359*b077aed3SPierre ProncheryThe format of the private key file; unspecified by default. 360*b077aed3SPierre ProncherySee L<openssl-format-options(1)> for details. 361*b077aed3SPierre Pronchery 362*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_item -} 363*b077aed3SPierre Pronchery 364*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_provider_item -} 365*b077aed3SPierre Pronchery 366*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_r_item -} 367*b077aed3SPierre Pronchery 368*b077aed3SPierre Pronchery=back 369*b077aed3SPierre Pronchery 370*b077aed3SPierre Pronchery=head2 Encryption and decryption options 371*b077aed3SPierre Pronchery 372*b077aed3SPierre Pronchery=over 4 373*b077aed3SPierre Pronchery 374*b077aed3SPierre Pronchery=item B<-originator> I<file> 375*b077aed3SPierre Pronchery 376*b077aed3SPierre ProncheryA certificate of the originator of the encrypted message. Necessary for 377*b077aed3SPierre Proncherydecryption when Key Agreement is in use for a shared key. 378*b077aed3SPierre Pronchery 379*b077aed3SPierre Pronchery=item B<-recip> I<file> 380*b077aed3SPierre Pronchery 381*b077aed3SPierre ProncheryWhen decrypting a message this specifies the certificate of the recipient. 382*b077aed3SPierre ProncheryThe certificate must match one of the recipients of the message. 383*b077aed3SPierre Pronchery 384*b077aed3SPierre ProncheryWhen encrypting a message this option may be used multiple times to specify 385*b077aed3SPierre Proncheryeach recipient. This form B<must> be used if customised parameters are 386*b077aed3SPierre Proncheryrequired (for example to specify RSA-OAEP). 387*b077aed3SPierre Pronchery 388*b077aed3SPierre ProncheryOnly certificates carrying RSA, Diffie-Hellman or EC keys are supported by this 389*b077aed3SPierre Proncheryoption. 390*b077aed3SPierre Pronchery 391*b077aed3SPierre Pronchery=item I<recipient-cert> ... 392*b077aed3SPierre Pronchery 393*b077aed3SPierre ProncheryThis is an alternative to using the B<-recip> option when encrypting a message. 394*b077aed3SPierre ProncheryOne or more certificate filennames may be given. 395*b077aed3SPierre Pronchery 396*b077aed3SPierre Pronchery=item B<-I<cipher>> 397*b077aed3SPierre Pronchery 398*b077aed3SPierre ProncheryThe encryption algorithm to use. For example triple DES (168 bits) - B<-des3> 399*b077aed3SPierre Proncheryor 256 bit AES - B<-aes256>. Any standard algorithm name (as used by the 400*b077aed3SPierre ProncheryEVP_get_cipherbyname() function) can also be used preceded by a dash, for 401*b077aed3SPierre Proncheryexample B<-aes-128-cbc>. See L<openssl-enc(1)> for a list of ciphers 402*b077aed3SPierre Proncherysupported by your version of OpenSSL. 403*b077aed3SPierre Pronchery 404*b077aed3SPierre ProncheryCurrently the AES variants with GCM mode are the only supported AEAD 405*b077aed3SPierre Proncheryalgorithms. 406*b077aed3SPierre Pronchery 407*b077aed3SPierre ProncheryIf not specified triple DES is used. Only used with B<-encrypt> and 408*b077aed3SPierre ProncheryB<-EncryptedData_create> commands. 409*b077aed3SPierre Pronchery 410*b077aed3SPierre Pronchery=item B<-wrap> I<cipher> 411*b077aed3SPierre Pronchery 412*b077aed3SPierre ProncheryCipher algorithm to use for key wrap when encrypting the message using Key 413*b077aed3SPierre ProncheryAgreement for key transport. The algorithm specified should be suitable for key 414*b077aed3SPierre Proncherywrap. 415*b077aed3SPierre Pronchery 416*b077aed3SPierre Pronchery=item B<-aes128-wrap>, B<-aes192-wrap>, B<-aes256-wrap>, B<-des3-wrap> 417*b077aed3SPierre Pronchery 418*b077aed3SPierre ProncheryUse AES128, AES192, AES256, or 3DES-EDE, respectively, to wrap key. 419*b077aed3SPierre ProncheryDepending on the OpenSSL build options used, B<-des3-wrap> may not be supported. 420*b077aed3SPierre Pronchery 421*b077aed3SPierre Pronchery=item B<-debug_decrypt> 422*b077aed3SPierre Pronchery 423*b077aed3SPierre ProncheryThis option sets the B<CMS_DEBUG_DECRYPT> flag. This option should be used 424*b077aed3SPierre Proncherywith caution: see the notes section below. 425*b077aed3SPierre Pronchery 426*b077aed3SPierre Pronchery=back 427*b077aed3SPierre Pronchery 428*b077aed3SPierre Pronchery=head2 Signing options 429*b077aed3SPierre Pronchery 430*b077aed3SPierre Pronchery=over 4 431*b077aed3SPierre Pronchery 432*b077aed3SPierre Pronchery=item B<-md> I<digest> 433*b077aed3SPierre Pronchery 434*b077aed3SPierre ProncheryDigest algorithm to use when signing or resigning. If not present then the 435*b077aed3SPierre Proncherydefault digest algorithm for the signing key will be used (usually SHA1). 436*b077aed3SPierre Pronchery 437*b077aed3SPierre Pronchery=item B<-signer> I<file> 438*b077aed3SPierre Pronchery 439*b077aed3SPierre ProncheryA signing certificate. When signing or resigning a message, this option can be 440*b077aed3SPierre Proncheryused multiple times if more than one signer is required. 441*b077aed3SPierre Pronchery 442*b077aed3SPierre Pronchery=item B<-certfile> I<file> 443*b077aed3SPierre Pronchery 444*b077aed3SPierre ProncheryAllows additional certificates to be specified. When signing these will 445*b077aed3SPierre Proncherybe included with the message. When verifying these will be searched for 446*b077aed3SPierre Proncherythe signers certificates. 447*b077aed3SPierre ProncheryThe input can be in PEM, DER, or PKCS#12 format. 448*b077aed3SPierre Pronchery 449*b077aed3SPierre Pronchery=item B<-cades> 450*b077aed3SPierre Pronchery 451*b077aed3SPierre ProncheryWhen used with B<-sign>, 452*b077aed3SPierre Proncheryadd an ESS signingCertificate or ESS signingCertificateV2 signed-attribute 453*b077aed3SPierre Proncheryto the SignerInfo, in order to make the signature comply with the requirements 454*b077aed3SPierre Proncheryfor a CAdES Basic Electronic Signature (CAdES-BES). 455*b077aed3SPierre Pronchery 456*b077aed3SPierre Pronchery=item B<-nodetach> 457*b077aed3SPierre Pronchery 458*b077aed3SPierre ProncheryWhen signing a message use opaque signing: this form is more resistant 459*b077aed3SPierre Proncheryto translation by mail relays but it cannot be read by mail agents that 460*b077aed3SPierre Proncherydo not support S/MIME. Without this option cleartext signing with 461*b077aed3SPierre Proncherythe MIME type multipart/signed is used. 462*b077aed3SPierre Pronchery 463*b077aed3SPierre Pronchery=item B<-nocerts> 464*b077aed3SPierre Pronchery 465*b077aed3SPierre ProncheryWhen signing a message the signer's certificate is normally included 466*b077aed3SPierre Proncherywith this option it is excluded. This will reduce the size of the 467*b077aed3SPierre Proncherysigned message but the verifier must have a copy of the signers certificate 468*b077aed3SPierre Proncheryavailable locally (passed using the B<-certfile> option for example). 469*b077aed3SPierre Pronchery 470*b077aed3SPierre Pronchery=item B<-noattr> 471*b077aed3SPierre Pronchery 472*b077aed3SPierre ProncheryNormally when a message is signed a set of attributes are included which 473*b077aed3SPierre Proncheryinclude the signing time and supported symmetric algorithms. With this 474*b077aed3SPierre Proncheryoption they are not included. 475*b077aed3SPierre Pronchery 476*b077aed3SPierre Pronchery=item B<-nosmimecap> 477*b077aed3SPierre Pronchery 478*b077aed3SPierre ProncheryExclude the list of supported algorithms from signed attributes, other options 479*b077aed3SPierre Proncherysuch as signing time and content type are still included. 480*b077aed3SPierre Pronchery 481*b077aed3SPierre Pronchery=item B<-receipt_request_all>, B<-receipt_request_first> 482*b077aed3SPierre Pronchery 483*b077aed3SPierre ProncheryFor B<-sign> option include a signed receipt request. Indicate requests should 484*b077aed3SPierre Proncherybe provided by all recipient or first tier recipients (those mailed directly 485*b077aed3SPierre Proncheryand not from a mailing list). Ignored it B<-receipt_request_from> is included. 486*b077aed3SPierre Pronchery 487*b077aed3SPierre Pronchery=item B<-receipt_request_from> I<emailaddress> 488*b077aed3SPierre Pronchery 489*b077aed3SPierre ProncheryFor B<-sign> option include a signed receipt request. Add an explicit email 490*b077aed3SPierre Proncheryaddress where receipts should be supplied. 491*b077aed3SPierre Pronchery 492*b077aed3SPierre Pronchery=item B<-receipt_request_to> I<emailaddress> 493*b077aed3SPierre Pronchery 494*b077aed3SPierre ProncheryAdd an explicit email address where signed receipts should be sent to. This 495*b077aed3SPierre Proncheryoption B<must> but supplied if a signed receipt is requested. 496*b077aed3SPierre Pronchery 497*b077aed3SPierre Pronchery=back 498*b077aed3SPierre Pronchery 499*b077aed3SPierre Pronchery=head2 Verification options 500*b077aed3SPierre Pronchery 501*b077aed3SPierre Pronchery=over 4 502*b077aed3SPierre Pronchery 503*b077aed3SPierre Pronchery=item B<-signer> I<file> 504*b077aed3SPierre Pronchery 505*b077aed3SPierre ProncheryIf a message has been verified successfully then the signers certificate(s) 506*b077aed3SPierre Proncherywill be written to this file if the verification was successful. 507*b077aed3SPierre Pronchery 508*b077aed3SPierre Pronchery=item B<-content> I<filename> 509*b077aed3SPierre Pronchery 510*b077aed3SPierre ProncheryThis specifies a file containing the detached content for operations taking 511*b077aed3SPierre ProncheryS/MIME input, such as the B<-verify> command. This is only usable if the CMS 512*b077aed3SPierre Proncherystructure is using the detached signature form where the content is 513*b077aed3SPierre Proncherynot included. This option will override any content if the input format 514*b077aed3SPierre Proncheryis S/MIME and it uses the multipart/signed MIME content type. 515*b077aed3SPierre Pronchery 516*b077aed3SPierre Pronchery=item B<-no_content_verify> 517*b077aed3SPierre Pronchery 518*b077aed3SPierre ProncheryDo not verify signed content signatures. 519*b077aed3SPierre Pronchery 520*b077aed3SPierre Pronchery=item B<-no_attr_verify> 521*b077aed3SPierre Pronchery 522*b077aed3SPierre ProncheryDo not verify signed attribute signatures. 523*b077aed3SPierre Pronchery 524*b077aed3SPierre Pronchery=item B<-nosigs> 525*b077aed3SPierre Pronchery 526*b077aed3SPierre ProncheryDon't verify message signature. 527*b077aed3SPierre Pronchery 528*b077aed3SPierre Pronchery=item B<-noverify> 529*b077aed3SPierre Pronchery 530*b077aed3SPierre ProncheryDo not verify the signers certificate of a signed message. 531*b077aed3SPierre Pronchery 532*b077aed3SPierre Pronchery=item B<-nointern> 533*b077aed3SPierre Pronchery 534*b077aed3SPierre ProncheryWhen verifying a message normally certificates (if any) included in 535*b077aed3SPierre Proncherythe message are searched for the signing certificate. With this option 536*b077aed3SPierre Proncheryonly the certificates specified in the B<-certfile> option are used. 537*b077aed3SPierre ProncheryThe supplied certificates can still be used as untrusted CAs however. 538*b077aed3SPierre Pronchery 539*b077aed3SPierre Pronchery=item B<-cades> 540*b077aed3SPierre Pronchery 541*b077aed3SPierre ProncheryWhen used with B<-verify>, require and check signer certificate digest. 542*b077aed3SPierre ProncherySee the NOTES section for more details. 543*b077aed3SPierre Pronchery 544*b077aed3SPierre Pronchery=item B<-verify_retcode> 545*b077aed3SPierre Pronchery 546*b077aed3SPierre ProncheryExit nonzero on verification failure. 547*b077aed3SPierre Pronchery 548*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_trust_item -} 549*b077aed3SPierre Pronchery 550*b077aed3SPierre Pronchery=back 551*b077aed3SPierre Pronchery 552*b077aed3SPierre Pronchery=head2 Output options 553*b077aed3SPierre Pronchery 554*b077aed3SPierre Pronchery=over 4 555*b077aed3SPierre Pronchery 556*b077aed3SPierre Pronchery=item B<-keyid> 557*b077aed3SPierre Pronchery 558*b077aed3SPierre ProncheryUse subject key identifier to identify certificates instead of issuer name and 559*b077aed3SPierre Proncheryserial number. The supplied certificate B<must> include a subject key 560*b077aed3SPierre Proncheryidentifier extension. Supported by B<-sign> and B<-encrypt> options. 561*b077aed3SPierre Pronchery 562*b077aed3SPierre Pronchery=item B<-econtent_type> I<type> 563*b077aed3SPierre Pronchery 564*b077aed3SPierre ProncherySet the encapsulated content type to I<type> if not supplied the B<Data> type 565*b077aed3SPierre Proncheryis used. The I<type> argument can be any valid OID name in either text or 566*b077aed3SPierre Proncherynumerical format. 567*b077aed3SPierre Pronchery 568*b077aed3SPierre Pronchery=item B<-text> 569*b077aed3SPierre Pronchery 570*b077aed3SPierre ProncheryThis option adds plain text (text/plain) MIME headers to the supplied 571*b077aed3SPierre Proncherymessage if encrypting or signing. If decrypting or verifying it strips 572*b077aed3SPierre Proncheryoff text headers: if the decrypted or verified message is not of MIME 573*b077aed3SPierre Proncherytype text/plain then an error occurs. 574*b077aed3SPierre Pronchery 575*b077aed3SPierre Pronchery=item B<-certsout> I<file> 576*b077aed3SPierre Pronchery 577*b077aed3SPierre ProncheryAny certificates contained in the input message are written to I<file>. 578*b077aed3SPierre Pronchery 579*b077aed3SPierre Pronchery=item B<-to>, B<-from>, B<-subject> 580*b077aed3SPierre Pronchery 581*b077aed3SPierre ProncheryThe relevant email headers. These are included outside the signed 582*b077aed3SPierre Proncheryportion of a message so they may be included manually. If signing 583*b077aed3SPierre Proncherythen many S/MIME mail clients check the signers certificate's email 584*b077aed3SPierre Proncheryaddress matches that specified in the From: address. 585*b077aed3SPierre Pronchery 586*b077aed3SPierre Pronchery=back 587*b077aed3SPierre Pronchery 588*b077aed3SPierre Pronchery=head2 Printing options 589*b077aed3SPierre Pronchery 590*b077aed3SPierre Pronchery=over 4 591*b077aed3SPierre Pronchery 592*b077aed3SPierre Pronchery=item B<-noout> 593*b077aed3SPierre Pronchery 594*b077aed3SPierre ProncheryFor the B<-cmsout> operation do not output the parsed CMS structure. 595*b077aed3SPierre ProncheryThis is useful if the syntax of the CMS structure is being checked. 596*b077aed3SPierre Pronchery 597*b077aed3SPierre Pronchery=item B<-print> 598*b077aed3SPierre Pronchery 599*b077aed3SPierre ProncheryFor the B<-cmsout> operation print out all fields of the CMS structure. 600*b077aed3SPierre ProncheryThis implies B<-noout>. 601*b077aed3SPierre ProncheryThis is mainly useful for testing purposes. 602*b077aed3SPierre Pronchery 603*b077aed3SPierre Pronchery=item B<-nameopt> I<option> 604*b077aed3SPierre Pronchery 605*b077aed3SPierre ProncheryFor the B<-cmsout> operation when B<-print> option is in use, specifies 606*b077aed3SPierre Proncheryprinting options for string fields. For most cases B<utf8> is reasonable value. 607*b077aed3SPierre ProncherySee L<openssl-namedisplay-options(1)> for details. 608*b077aed3SPierre Pronchery 609*b077aed3SPierre Pronchery=item B<-receipt_request_print> 610*b077aed3SPierre Pronchery 611*b077aed3SPierre ProncheryFor the B<-verify> operation print out the contents of any signed receipt 612*b077aed3SPierre Proncheryrequests. 613*b077aed3SPierre Pronchery 614*b077aed3SPierre Pronchery=back 615*b077aed3SPierre Pronchery 616*b077aed3SPierre Pronchery=head2 Validation options 617*b077aed3SPierre Pronchery 618*b077aed3SPierre Pronchery=over 4 619*b077aed3SPierre Pronchery 620*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_v_item -} 621*b077aed3SPierre Pronchery 622*b077aed3SPierre ProncheryAny validation errors cause the command to exit. 623*b077aed3SPierre Pronchery 624*b077aed3SPierre Pronchery=back 625*b077aed3SPierre Pronchery 626*b077aed3SPierre Pronchery=head1 NOTES 627*b077aed3SPierre Pronchery 628*b077aed3SPierre ProncheryThe MIME message must be sent without any blank lines between the 629*b077aed3SPierre Proncheryheaders and the output. Some mail programs will automatically add 630*b077aed3SPierre Proncherya blank line. Piping the mail directly to sendmail is one way to 631*b077aed3SPierre Proncheryachieve the correct format. 632*b077aed3SPierre Pronchery 633*b077aed3SPierre ProncheryThe supplied message to be signed or encrypted must include the 634*b077aed3SPierre Proncherynecessary MIME headers or many S/MIME clients won't display it 635*b077aed3SPierre Proncheryproperly (if at all). You can use the B<-text> option to automatically 636*b077aed3SPierre Proncheryadd plain text headers. 637*b077aed3SPierre Pronchery 638*b077aed3SPierre ProncheryA "signed and encrypted" message is one where a signed message is 639*b077aed3SPierre Proncherythen encrypted. This can be produced by encrypting an already signed 640*b077aed3SPierre Proncherymessage: see the examples section. 641*b077aed3SPierre Pronchery 642*b077aed3SPierre ProncheryThis version of the program only allows one signer per message but it 643*b077aed3SPierre Proncherywill verify multiple signers on received messages. Some S/MIME clients 644*b077aed3SPierre Proncherychoke if a message contains multiple signers. It is possible to sign 645*b077aed3SPierre Proncherymessages "in parallel" by signing an already signed message. 646*b077aed3SPierre Pronchery 647*b077aed3SPierre ProncheryThe options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME 648*b077aed3SPierre Proncheryclients. Strictly speaking these process CMS enveloped data: CMS 649*b077aed3SPierre Proncheryencrypted data is used for other purposes. 650*b077aed3SPierre Pronchery 651*b077aed3SPierre ProncheryThe B<-resign> option uses an existing message digest when adding a new 652*b077aed3SPierre Proncherysigner. This means that attributes must be present in at least one existing 653*b077aed3SPierre Proncherysigner using the same message digest or this operation will fail. 654*b077aed3SPierre Pronchery 655*b077aed3SPierre ProncheryThe B<-stream> and B<-indef> options enable streaming I/O support. 656*b077aed3SPierre ProncheryAs a result the encoding is BER using indefinite length constructed encoding 657*b077aed3SPierre Proncheryand no longer DER. Streaming is supported for the B<-encrypt> operation and the 658*b077aed3SPierre ProncheryB<-sign> operation if the content is not detached. 659*b077aed3SPierre Pronchery 660*b077aed3SPierre ProncheryStreaming is always used for the B<-sign> operation with detached data but 661*b077aed3SPierre Proncherysince the content is no longer part of the CMS structure the encoding 662*b077aed3SPierre Proncheryremains DER. 663*b077aed3SPierre Pronchery 664*b077aed3SPierre ProncheryIf the B<-decrypt> option is used without a recipient certificate then an 665*b077aed3SPierre Proncheryattempt is made to locate the recipient by trying each potential recipient 666*b077aed3SPierre Proncheryin turn using the supplied private key. To thwart the MMA attack 667*b077aed3SPierre Pronchery(Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all recipients are 668*b077aed3SPierre Proncherytried whether they succeed or not and if no recipients match the message 669*b077aed3SPierre Proncheryis "decrypted" using a random key which will typically output garbage. 670*b077aed3SPierre ProncheryThe B<-debug_decrypt> option can be used to disable the MMA attack protection 671*b077aed3SPierre Proncheryand return an error if no recipient can be found: this option should be used 672*b077aed3SPierre Proncherywith caution. For a fuller description see L<CMS_decrypt(3)>). 673*b077aed3SPierre Pronchery 674*b077aed3SPierre Pronchery=head1 CADES BASIC ELECTRONIC SIGNATURE (CADES-BES) 675*b077aed3SPierre Pronchery 676*b077aed3SPierre ProncheryA CAdES Basic Electronic Signature (CAdES-BES), 677*b077aed3SPierre Proncheryas defined in the European Standard ETSI EN 319 122-1 V1.1.1, contains: 678*b077aed3SPierre Pronchery 679*b077aed3SPierre Pronchery=over 4 680*b077aed3SPierre Pronchery 681*b077aed3SPierre Pronchery=item * 682*b077aed3SPierre Pronchery 683*b077aed3SPierre ProncheryThe signed user data as defined in CMS (RFC 3852); 684*b077aed3SPierre Pronchery 685*b077aed3SPierre Pronchery=item * 686*b077aed3SPierre Pronchery 687*b077aed3SPierre ProncheryContent-type of the EncapsulatedContentInfo value being signed; 688*b077aed3SPierre Pronchery 689*b077aed3SPierre Pronchery=item * 690*b077aed3SPierre Pronchery 691*b077aed3SPierre ProncheryMessage-digest of the eContent OCTET STRING within encapContentInfo being signed; 692*b077aed3SPierre Pronchery 693*b077aed3SPierre Pronchery=item * 694*b077aed3SPierre Pronchery 695*b077aed3SPierre ProncheryAn ESS signingCertificate or ESS signingCertificateV2 attribute, 696*b077aed3SPierre Proncheryas defined in Enhanced Security Services (ESS), RFC 2634 and RFC 5035. 697*b077aed3SPierre ProncheryAn ESS signingCertificate attribute only allows for SHA-1 as digest algorithm. 698*b077aed3SPierre ProncheryAn ESS signingCertificateV2 attribute allows for any digest algorithm. 699*b077aed3SPierre Pronchery 700*b077aed3SPierre Pronchery=item * 701*b077aed3SPierre Pronchery 702*b077aed3SPierre ProncheryThe digital signature value computed on the user data and, when present, on the signed attributes. 703*b077aed3SPierre Pronchery 704*b077aed3SPierre ProncheryNOTE that the B<-cades> option applies to the B<-sign> or B<-verify> operations. 705*b077aed3SPierre ProncheryWith this option, the B<-verify> operation also requires that the 706*b077aed3SPierre ProncherysigningCertificate attribute is present and checks that the given identifiers 707*b077aed3SPierre Proncherymatch the verification trust chain built during the verification process. 708*b077aed3SPierre Pronchery 709*b077aed3SPierre Pronchery=back 710*b077aed3SPierre Pronchery 711*b077aed3SPierre Pronchery=head1 EXIT CODES 712*b077aed3SPierre Pronchery 713*b077aed3SPierre Pronchery=over 4 714*b077aed3SPierre Pronchery 715*b077aed3SPierre Pronchery=item Z<>0 716*b077aed3SPierre Pronchery 717*b077aed3SPierre ProncheryThe operation was completely successfully. 718*b077aed3SPierre Pronchery 719*b077aed3SPierre Pronchery=item Z<>1 720*b077aed3SPierre Pronchery 721*b077aed3SPierre ProncheryAn error occurred parsing the command options. 722*b077aed3SPierre Pronchery 723*b077aed3SPierre Pronchery=item Z<>2 724*b077aed3SPierre Pronchery 725*b077aed3SPierre ProncheryOne of the input files could not be read. 726*b077aed3SPierre Pronchery 727*b077aed3SPierre Pronchery=item Z<>3 728*b077aed3SPierre Pronchery 729*b077aed3SPierre ProncheryAn error occurred creating the CMS file or when reading the MIME 730*b077aed3SPierre Proncherymessage. 731*b077aed3SPierre Pronchery 732*b077aed3SPierre Pronchery=item Z<>4 733*b077aed3SPierre Pronchery 734*b077aed3SPierre ProncheryAn error occurred decrypting or verifying the message. 735*b077aed3SPierre Pronchery 736*b077aed3SPierre Pronchery=item Z<>5 737*b077aed3SPierre Pronchery 738*b077aed3SPierre ProncheryThe message was verified correctly but an error occurred writing out 739*b077aed3SPierre Proncherythe signers certificates. 740*b077aed3SPierre Pronchery 741*b077aed3SPierre Pronchery=back 742*b077aed3SPierre Pronchery 743*b077aed3SPierre Pronchery=head1 COMPATIBILITY WITH PKCS#7 FORMAT 744*b077aed3SPierre Pronchery 745*b077aed3SPierre ProncheryL<openssl-smime(1)> can only process the older B<PKCS#7> format. 746*b077aed3SPierre ProncheryB<openssl cms> supports Cryptographic Message Syntax format. 747*b077aed3SPierre ProncheryUse of some features will result in messages which cannot be processed by 748*b077aed3SPierre Proncheryapplications which only support the older format. These are detailed below. 749*b077aed3SPierre Pronchery 750*b077aed3SPierre ProncheryThe use of the B<-keyid> option with B<-sign> or B<-encrypt>. 751*b077aed3SPierre Pronchery 752*b077aed3SPierre ProncheryThe B<-outform> I<PEM> option uses different headers. 753*b077aed3SPierre Pronchery 754*b077aed3SPierre ProncheryThe B<-compress> option. 755*b077aed3SPierre Pronchery 756*b077aed3SPierre ProncheryThe B<-secretkey> option when used with B<-encrypt>. 757*b077aed3SPierre Pronchery 758*b077aed3SPierre ProncheryThe use of PSS with B<-sign>. 759*b077aed3SPierre Pronchery 760*b077aed3SPierre ProncheryThe use of OAEP or non-RSA keys with B<-encrypt>. 761*b077aed3SPierre Pronchery 762*b077aed3SPierre ProncheryAdditionally the B<-EncryptedData_create> and B<-data_create> type cannot 763*b077aed3SPierre Proncherybe processed by the older L<openssl-smime(1)> command. 764*b077aed3SPierre Pronchery 765*b077aed3SPierre Pronchery=head1 EXAMPLES 766*b077aed3SPierre Pronchery 767*b077aed3SPierre ProncheryCreate a cleartext signed message: 768*b077aed3SPierre Pronchery 769*b077aed3SPierre Pronchery openssl cms -sign -in message.txt -text -out mail.msg \ 770*b077aed3SPierre Pronchery -signer mycert.pem 771*b077aed3SPierre Pronchery 772*b077aed3SPierre ProncheryCreate an opaque signed message 773*b077aed3SPierre Pronchery 774*b077aed3SPierre Pronchery openssl cms -sign -in message.txt -text -out mail.msg -nodetach \ 775*b077aed3SPierre Pronchery -signer mycert.pem 776*b077aed3SPierre Pronchery 777*b077aed3SPierre ProncheryCreate a signed message, include some additional certificates and 778*b077aed3SPierre Proncheryread the private key from another file: 779*b077aed3SPierre Pronchery 780*b077aed3SPierre Pronchery openssl cms -sign -in in.txt -text -out mail.msg \ 781*b077aed3SPierre Pronchery -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem 782*b077aed3SPierre Pronchery 783*b077aed3SPierre ProncheryCreate a signed message with two signers, use key identifier: 784*b077aed3SPierre Pronchery 785*b077aed3SPierre Pronchery openssl cms -sign -in message.txt -text -out mail.msg \ 786*b077aed3SPierre Pronchery -signer mycert.pem -signer othercert.pem -keyid 787*b077aed3SPierre Pronchery 788*b077aed3SPierre ProncherySend a signed message under Unix directly to sendmail, including headers: 789*b077aed3SPierre Pronchery 790*b077aed3SPierre Pronchery openssl cms -sign -in in.txt -text -signer mycert.pem \ 791*b077aed3SPierre Pronchery -from steve@openssl.org -to someone@somewhere \ 792*b077aed3SPierre Pronchery -subject "Signed message" | sendmail someone@somewhere 793*b077aed3SPierre Pronchery 794*b077aed3SPierre ProncheryVerify a message and extract the signer's certificate if successful: 795*b077aed3SPierre Pronchery 796*b077aed3SPierre Pronchery openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt 797*b077aed3SPierre Pronchery 798*b077aed3SPierre ProncherySend encrypted mail using triple DES: 799*b077aed3SPierre Pronchery 800*b077aed3SPierre Pronchery openssl cms -encrypt -in in.txt -from steve@openssl.org \ 801*b077aed3SPierre Pronchery -to someone@somewhere -subject "Encrypted message" \ 802*b077aed3SPierre Pronchery -des3 user.pem -out mail.msg 803*b077aed3SPierre Pronchery 804*b077aed3SPierre ProncherySign and encrypt mail: 805*b077aed3SPierre Pronchery 806*b077aed3SPierre Pronchery openssl cms -sign -in ml.txt -signer my.pem -text \ 807*b077aed3SPierre Pronchery | openssl cms -encrypt -out mail.msg \ 808*b077aed3SPierre Pronchery -from steve@openssl.org -to someone@somewhere \ 809*b077aed3SPierre Pronchery -subject "Signed and Encrypted message" -des3 user.pem 810*b077aed3SPierre Pronchery 811*b077aed3SPierre ProncheryNote: the encryption command does not include the B<-text> option because the 812*b077aed3SPierre Proncherymessage being encrypted already has MIME headers. 813*b077aed3SPierre Pronchery 814*b077aed3SPierre ProncheryDecrypt a message: 815*b077aed3SPierre Pronchery 816*b077aed3SPierre Pronchery openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem 817*b077aed3SPierre Pronchery 818*b077aed3SPierre ProncheryThe output from Netscape form signing is a PKCS#7 structure with the 819*b077aed3SPierre Proncherydetached signature format. You can use this program to verify the 820*b077aed3SPierre Proncherysignature by line wrapping the base64 encoded structure and surrounding 821*b077aed3SPierre Proncheryit with: 822*b077aed3SPierre Pronchery 823*b077aed3SPierre Pronchery -----BEGIN PKCS7----- 824*b077aed3SPierre Pronchery -----END PKCS7----- 825*b077aed3SPierre Pronchery 826*b077aed3SPierre Proncheryand using the command, 827*b077aed3SPierre Pronchery 828*b077aed3SPierre Pronchery openssl cms -verify -inform PEM -in signature.pem -content content.txt 829*b077aed3SPierre Pronchery 830*b077aed3SPierre Proncheryalternatively you can base64 decode the signature and use 831*b077aed3SPierre Pronchery 832*b077aed3SPierre Pronchery openssl cms -verify -inform DER -in signature.der -content content.txt 833*b077aed3SPierre Pronchery 834*b077aed3SPierre ProncheryCreate an encrypted message using 128 bit Camellia: 835*b077aed3SPierre Pronchery 836*b077aed3SPierre Pronchery openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem 837*b077aed3SPierre Pronchery 838*b077aed3SPierre ProncheryAdd a signer to an existing message: 839*b077aed3SPierre Pronchery 840*b077aed3SPierre Pronchery openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg 841*b077aed3SPierre Pronchery 842*b077aed3SPierre ProncherySign a message using RSA-PSS: 843*b077aed3SPierre Pronchery 844*b077aed3SPierre Pronchery openssl cms -sign -in message.txt -text -out mail.msg \ 845*b077aed3SPierre Pronchery -signer mycert.pem -keyopt rsa_padding_mode:pss 846*b077aed3SPierre Pronchery 847*b077aed3SPierre ProncheryCreate an encrypted message using RSA-OAEP: 848*b077aed3SPierre Pronchery 849*b077aed3SPierre Pronchery openssl cms -encrypt -in plain.txt -out mail.msg \ 850*b077aed3SPierre Pronchery -recip cert.pem -keyopt rsa_padding_mode:oaep 851*b077aed3SPierre Pronchery 852*b077aed3SPierre ProncheryUse SHA256 KDF with an ECDH certificate: 853*b077aed3SPierre Pronchery 854*b077aed3SPierre Pronchery openssl cms -encrypt -in plain.txt -out mail.msg \ 855*b077aed3SPierre Pronchery -recip ecdhcert.pem -keyopt ecdh_kdf_md:sha256 856*b077aed3SPierre Pronchery 857*b077aed3SPierre ProncheryPrint CMS signed binary data in human-readable form: 858*b077aed3SPierre Pronchery 859*b077aed3SPierre Proncheryopenssl cms -in signed.cms -binary -inform DER -cmsout -print 860*b077aed3SPierre Pronchery 861*b077aed3SPierre Pronchery=head1 BUGS 862*b077aed3SPierre Pronchery 863*b077aed3SPierre ProncheryThe MIME parser isn't very clever: it seems to handle most messages that I've 864*b077aed3SPierre Proncherythrown at it but it may choke on others. 865*b077aed3SPierre Pronchery 866*b077aed3SPierre ProncheryThe code currently will only write out the signer's certificate to a file: if 867*b077aed3SPierre Proncherythe signer has a separate encryption certificate this must be manually 868*b077aed3SPierre Proncheryextracted. There should be some heuristic that determines the correct 869*b077aed3SPierre Proncheryencryption certificate. 870*b077aed3SPierre Pronchery 871*b077aed3SPierre ProncheryIdeally a database should be maintained of a certificates for each email 872*b077aed3SPierre Proncheryaddress. 873*b077aed3SPierre Pronchery 874*b077aed3SPierre ProncheryThe code doesn't currently take note of the permitted symmetric encryption 875*b077aed3SPierre Proncheryalgorithms as supplied in the SMIMECapabilities signed attribute. this means the 876*b077aed3SPierre Proncheryuser has to manually include the correct encryption algorithm. It should store 877*b077aed3SPierre Proncherythe list of permitted ciphers in a database and only use those. 878*b077aed3SPierre Pronchery 879*b077aed3SPierre ProncheryNo revocation checking is done on the signer's certificate. 880*b077aed3SPierre Pronchery 881*b077aed3SPierre Pronchery=head1 SEE ALSO 882*b077aed3SPierre Pronchery 883*b077aed3SPierre ProncheryL<ossl_store-file(7)> 884*b077aed3SPierre Pronchery 885*b077aed3SPierre Pronchery=head1 HISTORY 886*b077aed3SPierre Pronchery 887*b077aed3SPierre ProncheryThe use of multiple B<-signer> options and the B<-resign> command were first 888*b077aed3SPierre Proncheryadded in OpenSSL 1.0.0. 889*b077aed3SPierre Pronchery 890*b077aed3SPierre ProncheryThe B<-keyopt> option was added in OpenSSL 1.0.2. 891*b077aed3SPierre Pronchery 892*b077aed3SPierre ProncherySupport for RSA-OAEP and RSA-PSS was added in OpenSSL 1.0.2. 893*b077aed3SPierre Pronchery 894*b077aed3SPierre ProncheryThe use of non-RSA keys with B<-encrypt> and B<-decrypt> 895*b077aed3SPierre Proncherywas added in OpenSSL 1.0.2. 896*b077aed3SPierre Pronchery 897*b077aed3SPierre ProncheryThe -no_alt_chains option was added in OpenSSL 1.0.2b. 898*b077aed3SPierre Pronchery 899*b077aed3SPierre ProncheryThe B<-nameopt> option was added in OpenSSL 3.0.0. 900*b077aed3SPierre Pronchery 901*b077aed3SPierre ProncheryThe B<-engine> option was deprecated in OpenSSL 3.0. 902*b077aed3SPierre Pronchery 903*b077aed3SPierre Pronchery=head1 COPYRIGHT 904*b077aed3SPierre Pronchery 905*b077aed3SPierre ProncheryCopyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved. 906*b077aed3SPierre Pronchery 907*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 908*b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 909*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 910*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 911*b077aed3SPierre Pronchery 912*b077aed3SPierre Pronchery=cut 913