{
    "content": [
        {
            "type": "text",
            "text": "# OPENSSL-CMS (info)\n\n## NAME\n\nopenssl-cms - CMS command\n\n## SYNOPSIS\n\nopenssl cms [-help]\nGeneral options:\n[-in filename] [-out filename] [-config configfile]\nOperation options:\n[-encrypt] [-decrypt] [-sign] [-verify] [-resign] [-signreceipt]\n[-verifyreceipt receipt] [-digestcreate] [-digestverify] [-compress]\n[-uncompress] [-EncryptedDataencrypt] [-EncryptedDatadecrypt]\n[-datacreate] [-dataout] [-cmsout]\nFile format options:\n[-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform\nDER|PEM|SMIME] [-stream] [-indef] [-noindef] [-binary] [-crlfeol]\n[-asciicrlf]\nKeys and password options:\n[-pwripassword password] [-secretkey key] [-secretkeyid id] [-inkey\nfilename|uri] [-passin arg] [-keyopt name:parameter] [-keyform\nDER|PEM|P12|ENGINE] [-engine id] [-provider name] [-provider-path path]\n[-propquery propq] [-rand files] [-writerand file]\nEncryption options:\n[-originator file] [-recip file] [recipient-cert ...]  [-cipher] [-wrap\ncipher] [-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap]\n[-debugdecrypt]\nSigning options:\n[-md digest] [-signer file] [-certfile file] [-cades] [-nodetach]\n[-nocerts] [-noattr] [-nosmimecap] [-receiptrequestall]\n[-receiptrequestfirst] [-receiptrequestfrom emailaddress]\n[-receiptrequestto emailaddress]\nVerification options:\n[-signer file] [-content filename] [-nocontentverify]\n[-noattrverify] [-nosigs] [-noverify] [-nointern] [-cades]\n[-verifyretcode] [-CAfile file] [-no-CAfile] [-CApath dir]\n[-no-CApath] [-CAstore uri] [-no-CAstore]\nOutput options:\n[-keyid] [-econtenttype type] [-text] [-certsout file] [-to addr]\n[-from addr] [-subject subj]\nPrinting options:\n[-noout] [-print] [-nameopt option] [-receiptrequestprint]\nValidation options:\n[-allowproxycerts] [-attime timestamp] [-nochecktime]\n[-checksssig] [-crlcheck] [-crlcheckall] [-explicitpolicy]\n[-extendedcrl] [-ignorecritical] [-inhibitany] [-inhibitmap]\n[-partialchain] [-policy arg] [-policycheck] [-policyprint]\n[-purpose purpose] [-suiteB128] [-suiteB128only] [-suiteB192]\n[-trustedfirst] [-noaltchains] [-usedeltas] [-authlevel num]\n[-verifydepth num] [-verifyemail email] [-verifyhostname hostname]\n[-verifyip ip] [-verifyname name] [-x509strict] [-issuerchecks]\n\n## DESCRIPTION\n\nThis command handles data in CMS format such as S/MIME v3.1 email\nmessages.  It can encrypt, decrypt, sign, verify, compress, uncompress,\nand print messages.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (46 subsections)\n- **NOTES**\n- **EXIT CODES**\n- **EXAMPLES**\n- **BUGS**\n- **SEE ALSO**\n- **HISTORY**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "OPENSSL-CMS",
        "section": "",
        "mode": "info",
        "summary": "openssl-cms - CMS command",
        "synopsis": "openssl cms [-help]\nGeneral options:\n[-in filename] [-out filename] [-config configfile]\nOperation options:\n[-encrypt] [-decrypt] [-sign] [-verify] [-resign] [-signreceipt]\n[-verifyreceipt receipt] [-digestcreate] [-digestverify] [-compress]\n[-uncompress] [-EncryptedDataencrypt] [-EncryptedDatadecrypt]\n[-datacreate] [-dataout] [-cmsout]\nFile format options:\n[-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform\nDER|PEM|SMIME] [-stream] [-indef] [-noindef] [-binary] [-crlfeol]\n[-asciicrlf]\nKeys and password options:\n[-pwripassword password] [-secretkey key] [-secretkeyid id] [-inkey\nfilename|uri] [-passin arg] [-keyopt name:parameter] [-keyform\nDER|PEM|P12|ENGINE] [-engine id] [-provider name] [-provider-path path]\n[-propquery propq] [-rand files] [-writerand file]\nEncryption options:\n[-originator file] [-recip file] [recipient-cert ...]  [-cipher] [-wrap\ncipher] [-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap]\n[-debugdecrypt]\nSigning options:\n[-md digest] [-signer file] [-certfile file] [-cades] [-nodetach]\n[-nocerts] [-noattr] [-nosmimecap] [-receiptrequestall]\n[-receiptrequestfirst] [-receiptrequestfrom emailaddress]\n[-receiptrequestto emailaddress]\nVerification options:\n[-signer file] [-content filename] [-nocontentverify]\n[-noattrverify] [-nosigs] [-noverify] [-nointern] [-cades]\n[-verifyretcode] [-CAfile file] [-no-CAfile] [-CApath dir]\n[-no-CApath] [-CAstore uri] [-no-CAstore]\nOutput options:\n[-keyid] [-econtenttype type] [-text] [-certsout file] [-to addr]\n[-from addr] [-subject subj]\nPrinting options:\n[-noout] [-print] [-nameopt option] [-receiptrequestprint]\nValidation options:\n[-allowproxycerts] [-attime timestamp] [-nochecktime]\n[-checksssig] [-crlcheck] [-crlcheckall] [-explicitpolicy]\n[-extendedcrl] [-ignorecritical] [-inhibitany] [-inhibitmap]\n[-partialchain] [-policy arg] [-policycheck] [-policyprint]\n[-purpose purpose] [-suiteB128] [-suiteB128only] [-suiteB192]\n[-trustedfirst] [-noaltchains] [-usedeltas] [-authlevel num]\n[-verifydepth num] [-verifyemail email] [-verifyhostname hostname]\n[-verifyip ip] [-verifyname name] [-x509strict] [-issuerchecks]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Print out a usage message. General options -in filename The input message to be encrypted or signed or the message to be decrypted or verified. -out filename The message text that has been decrypted or verified or the output MIME format message that has been signed or verified. -config configfile See \"Configuration Option\" in openssl(1). Operation options"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Encrypt data for the given recipient certificates. Input file is the message to be encrypted. The output file is the encrypted data in MIME format. The actual CMS type is EnvelopedData. Note that no revocation check is done for the recipient cert, so if that key has been compromised, others may be able to decrypt the text."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Decrypt data using the supplied certificate and private key. Expects encrypted datain MIME format for the input file. The decrypted data is written to the output file."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Sign data using the supplied certificate and private key. Input file is the message to be signed. The signed data in MIME format is written to the output file."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Verify signed data. Expects a signed data on input and outputs the signed data. Both clear text and opaque signing is supported."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Resign a message: take an existing message and one or more new signers."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Generate and output a signed receipt for the supplied message. The input message must contain a signed receipt request. Functionality is otherwise similar to the -sign operation. -verifyreceipt receipt Verify a signed receipt in filename receipt. The input message must contain the original receipt request. Functionality is otherwise similar to the -verify operation."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Create a CMS DigestedData type."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Verify a CMS DigestedData type and output the content."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Create a CMS CompressedData type. OpenSSL must be compiled with zlib support for this option to work, otherwise it will output an error."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Uncompress a CMS CompressedData type and output the content. OpenSSL must be compiled with zlib support for this option to work, otherwise it will output an error."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Encrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type and output the content."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Decrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type and output the content."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Create a CMS Data type."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Data type and output the content."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Takes an input message and writes out a PEM encoded CMS structure. File format options -inform DER|PEM|SMIME The input format of the CMS structure (if one is being read); the default is SMIME. See openssl-format-options(1) for details. -outform DER|PEM|SMIME The output format of the CMS structure (if one is being written); the default is SMIME. See openssl-format-options(1) for details. -rctform DER|PEM|SMIME The signed receipt format for use with the -receiptverify; the default is SMIME. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The -stream and -indef options are equivalent and enable streaming I/O for encoding operations. This permits single pass processing of data without the need to hold the entire contents in memory, potentially supporting very large files. Streaming is automatically set for S/MIME signing with detached data if the output format is SMIME it is currently off by default for all other operations."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Disable streaming I/O where it would produce and indefinite length constructed encoding. This option currently has no effect. In future streaming will be enabled by default on all relevant operations and this option will disable it."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Normally the input message is converted to \"canonical\" format which is effectively using CR and LF as end of line: as required by the S/MIME specification. When this option is present no translation occurs. This is useful when handling binary data which may not be in MIME format."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Normally the output file uses a single LF as end of line. When this option is present CRLF is used instead."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When signing use ASCII CRLF format canonicalisation. This strips trailing whitespace from all lines, deletes trailing blank lines at EOF and sets the encapsulated content type. This option is normally used with detached content and an output signature format of DER. This option is not normally needed when verifying as it is enabled automatically if the encapsulated content format is detected. Keys and password options -pwripassword password Specify password for recipient. -secretkey key Specify symmetric key to use. The key must be supplied in hex format and be consistent with the algorithm used. Supported by the -EncryptedDataencrypt -EncryptedDatadecrypt, -encrypt and -decrypt options. When used with -encrypt or -decrypt the supplied key is used to wrap or unwrap the content encryption key using an AES key in the KEKRecipientInfo type. -secretkeyid id The key identifier for the supplied symmetric key for KEKRecipientInfo type. This option must be present if the -secretkey option is used with -encrypt. With -decrypt operations the id is used to locate the relevant key if it is not supplied then an attempt is used to decrypt any KEKRecipientInfo structures. -inkey filename|uri The private key to use when signing or decrypting. This must match the corresponding certificate. If this option is not specified then the private key must be included in the certificate file specified with the -recip or -signer file. When signing this option can be used multiple times to specify successive keys. -passin arg The private key password source. For more information about the format of arg see openssl-passphrase-options(1). -keyopt name:parameter For signing and encryption this option can be used multiple times to set customised parameters for the preceding key or certificate. It can currently be used to set RSA-PSS for signing, RSA-OAEP for encryption or to modify default parameters for ECDH. -keyform DER|PEM|P12|ENGINE The format of the private key file; unspecified by default. See openssl-format-options(1) for details. -engine id See \"Engine Options\" in openssl(1). This option is deprecated. -provider name -provider-path path -propquery propq See \"Provider Options\" in openssl(1), provider(7), and property(7). -rand files, -writerand file See \"Random State Options\" in openssl(1) for details. Encryption and decryption options -originator file A certificate of the originator of the encrypted message. Necessary for decryption when Key Agreement is in use for a shared key. -recip file When decrypting a message this specifies the certificate of the recipient. The certificate must match one of the recipients of the message. When encrypting a message this option may be used multiple times to specify each recipient. This form must be used if customised parameters are required (for example to specify RSA-OAEP). Only certificates carrying RSA, Diffie-Hellman or EC keys are supported by this option. recipient-cert ... This is an alternative to using the -recip option when encrypting a message. One or more certificate filennames may be given."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The encryption algorithm to use. For example triple DES (168 bits) - -des3 or 256 bit AES - -aes256. Any standard algorithm name (as used by the EVPgetcipherbyname() function) can also be used preceded by a dash, for example -aes-128-cbc. See openssl-enc(1) for a list of ciphers supported by your version of OpenSSL. Currently the AES variants with GCM mode are the only supported AEAD algorithms. If not specified triple DES is used. Only used with -encrypt and -EncryptedDatacreate commands. -wrap cipher Cipher algorithm to use for key wrap when encrypting the message using Key Agreement for key transport. The algorithm specified should be suitable for key wrap."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Use AES128, AES192, AES256, or 3DES-EDE, respectively, to wrap key. Depending on the OpenSSL build options used, -des3-wrap may not be supported."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option sets the CMSDEBUGDECRYPT flag. This option should be used with caution: see the notes section below. Signing options -md digest Digest algorithm to use when signing or resigning. If not present then the default digest algorithm for the signing key will be used (usually SHA1). -signer file A signing certificate. When signing or resigning a message, this option can be used multiple times if more than one signer is required. -certfile file Allows additional certificates to be specified. When signing these will be included with the message. When verifying these will be searched for the signers certificates. The input can be in PEM, DER, or PKCS#12 format."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When used with -sign, add an ESS signingCertificate or ESS signingCertificateV2 signed-attribute to the SignerInfo, in order to make the signature comply with the requirements for a CAdES Basic Electronic Signature (CAdES-BES)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When signing a message use opaque signing: this form is more resistant to translation by mail relays but it cannot be read by mail agents that do not support S/MIME. Without this option cleartext signing with the MIME type multipart/signed is used."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When signing a message the signer's certificate is normally included with this option it is excluded. This will reduce the size of the signed message but the verifier must have a copy of the signers certificate available locally (passed using the -certfile option for example)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Normally when a message is signed a set of attributes are included which include the signing time and supported symmetric algorithms. With this option they are not included."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Exclude the list of supported algorithms from signed attributes, other options such as signing time and content type are still included."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "For -sign option include a signed receipt request. Indicate requests should be provided by all recipient or first tier recipients (those mailed directly and not from a mailing list). Ignored it -receiptrequestfrom is included. -receiptrequestfrom emailaddress For -sign option include a signed receipt request. Add an explicit email address where receipts should be supplied. -receiptrequestto emailaddress Add an explicit email address where signed receipts should be sent to. This option must but supplied if a signed receipt is requested. Verification options -signer file If a message has been verified successfully then the signers certificate(s) will be written to this file if the verification was successful. -content filename This specifies a file containing the detached content for operations taking S/MIME input, such as the -verify command. This is only usable if the CMS structure is using the detached signature form where the content is not included. This option will override any content if the input format is S/MIME and it uses the multipart/signed MIME content type."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Do not verify signed content signatures."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Do not verify signed attribute signatures."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Don't verify message signature."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Do not verify the signers certificate of a signed message."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When verifying a message normally certificates (if any) included in the message are searched for the signing certificate. With this option only the certificates specified in the -certfile option are used. The supplied certificates can still be used as untrusted CAs however."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When used with -verify, require and check signer certificate digest. See the NOTES section for more details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Exit nonzero on verification failure. -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri,"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Trusted Certificate Options\" in openssl-verification-options(1) for details. Output options"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Use subject key identifier to identify certificates instead of issuer name and serial number. The supplied certificate must include a subject key identifier extension. Supported by -sign and -encrypt options. -econtenttype type Set the encapsulated content type to type if not supplied the Data type is used. The type argument can be any valid OID name in either text or numerical format."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option adds plain text (text/plain) MIME headers to the supplied message if encrypting or signing. If decrypting or verifying it strips off text headers: if the decrypted or verified message is not of MIME type text/plain then an error occurs. -certsout file Any certificates contained in the input message are written to file."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The relevant email headers. These are included outside the signed portion of a message so they may be included manually. If signing then many S/MIME mail clients check the signers certificate's email address matches that specified in the From: address. Printing options"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "For the -cmsout operation do not output the parsed CMS structure. This is useful if the syntax of the CMS structure is being checked."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "For the -cmsout operation print out all fields of the CMS structure. This implies -noout. This is mainly useful for testing purposes. -nameopt option For the -cmsout operation when -print option is in use, specifies printing options for string fields. For most cases utf8 is reasonable value. See openssl-namedisplay-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "For the -verify operation print out the contents of any signed receipt requests. Validation options -allowproxycerts, -attime, -nochecktime, -checksssig, -crlcheck, -crlcheckall, -explicitpolicy, -extendedcrl, -ignorecritical, -inhibitany, -inhibitmap, -noaltchains, -partialchain, -policy, -policycheck, -policyprint, -purpose, -suiteB128, -suiteB128only, -suiteB192, -trustedfirst, -usedeltas, -authlevel, -verifydepth,"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details. Any validation errors cause the command to exit."
            }
        ],
        "examples": [
            "Create a cleartext signed message:",
            "openssl cms -sign -in message.txt -text -out mail.msg \\",
            "-signer mycert.pem",
            "Create an opaque signed message",
            "openssl cms -sign -in message.txt -text -out mail.msg -nodetach \\",
            "-signer mycert.pem",
            "Create a signed message, include some additional certificates and read",
            "the private key from another file:",
            "openssl cms -sign -in in.txt -text -out mail.msg \\",
            "-signer mycert.pem -inkey mykey.pem -certfile mycerts.pem",
            "Create a signed message with two signers, use key identifier:",
            "openssl cms -sign -in message.txt -text -out mail.msg \\",
            "-signer mycert.pem -signer othercert.pem -keyid",
            "Send a signed message under Unix directly to sendmail, including",
            "headers:",
            "openssl cms -sign -in in.txt -text -signer mycert.pem \\",
            "-from steve@openssl.org -to someone@somewhere \\",
            "-subject \"Signed message\" | sendmail someone@somewhere",
            "Verify a message and extract the signer's certificate if successful:",
            "openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt",
            "Send encrypted mail using triple DES:",
            "openssl cms -encrypt -in in.txt -from steve@openssl.org \\",
            "-to someone@somewhere -subject \"Encrypted message\" \\",
            "-des3 user.pem -out mail.msg",
            "Sign and encrypt mail:",
            "openssl cms -sign -in ml.txt -signer my.pem -text \\",
            "| openssl cms -encrypt -out mail.msg \\",
            "-from steve@openssl.org -to someone@somewhere \\",
            "-subject \"Signed and Encrypted message\" -des3 user.pem",
            "Note: the encryption command does not include the -text option because",
            "the message being encrypted already has MIME headers.",
            "Decrypt a message:",
            "openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem",
            "The output from Netscape form signing is a PKCS#7 structure with the",
            "detached signature format. You can use this program to verify the",
            "signature by line wrapping the base64 encoded structure and surrounding",
            "it with:",
            "-----BEGIN PKCS7-----",
            "-----END PKCS7-----",
            "and using the command,",
            "openssl cms -verify -inform PEM -in signature.pem -content content.txt",
            "alternatively you can base64 decode the signature and use",
            "openssl cms -verify -inform DER -in signature.der -content content.txt",
            "Create an encrypted message using 128 bit Camellia:",
            "openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem",
            "Add a signer to an existing message:",
            "openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg",
            "Sign a message using RSA-PSS:",
            "openssl cms -sign -in message.txt -text -out mail.msg \\",
            "-signer mycert.pem -keyopt rsapaddingmode:pss",
            "Create an encrypted message using RSA-OAEP:",
            "openssl cms -encrypt -in plain.txt -out mail.msg \\",
            "-recip cert.pem -keyopt rsapaddingmode:oaep",
            "Use SHA256 KDF with an ECDH certificate:",
            "openssl cms -encrypt -in plain.txt -out mail.msg \\",
            "-recip ecdhcert.pem -keyopt ecdhkdfmd:sha256",
            "Print CMS signed binary data in human-readable form:",
            "openssl cms -in signed.cms -binary -inform DER -cmsout -print"
        ],
        "see_also": [
            {
                "name": "osslstore-file",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/osslstore-file/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 66,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 7,
                "subsections": [
                    {
                        "name": "-help",
                        "lines": 15
                    },
                    {
                        "name": "-encrypt",
                        "lines": 8
                    },
                    {
                        "name": "-decrypt",
                        "lines": 4
                    },
                    {
                        "name": "-sign",
                        "lines": 4
                    },
                    {
                        "name": "-verify",
                        "lines": 3
                    },
                    {
                        "name": "-resign",
                        "lines": 3
                    },
                    {
                        "name": "-sign_receipt",
                        "lines": 9
                    },
                    {
                        "name": "-digest_create",
                        "lines": 2
                    },
                    {
                        "name": "-digest_verify",
                        "lines": 2
                    },
                    {
                        "name": "-compress",
                        "lines": 4
                    },
                    {
                        "name": "-uncompress",
                        "lines": 4
                    },
                    {
                        "name": "-EncryptedData_encrypt",
                        "lines": 3
                    },
                    {
                        "name": "-EncryptedData_decrypt",
                        "lines": 3
                    },
                    {
                        "name": "-data_create",
                        "lines": 2
                    },
                    {
                        "name": "-data_out",
                        "lines": 2
                    },
                    {
                        "name": "-cmsout",
                        "lines": 15
                    },
                    {
                        "name": "-stream, -indef",
                        "lines": 7
                    },
                    {
                        "name": "-noindef",
                        "lines": 5
                    },
                    {
                        "name": "-binary",
                        "lines": 6
                    },
                    {
                        "name": "-crlfeol",
                        "lines": 3
                    },
                    {
                        "name": "-asciicrlf",
                        "lines": 79
                    },
                    {
                        "name": "-cipher",
                        "lines": 17
                    },
                    {
                        "name": "-aes128-wrap, -aes192-wrap, -aes256-wrap, -des3-wrap",
                        "lines": 4
                    },
                    {
                        "name": "-debug_decrypt",
                        "lines": 20
                    },
                    {
                        "name": "-cades",
                        "lines": 5
                    },
                    {
                        "name": "-nodetach",
                        "lines": 5
                    },
                    {
                        "name": "-nocerts",
                        "lines": 6
                    },
                    {
                        "name": "-noattr",
                        "lines": 4
                    },
                    {
                        "name": "-nosmimecap",
                        "lines": 4
                    },
                    {
                        "name": "-receipt_request_all, -receipt_request_first",
                        "lines": 27
                    },
                    {
                        "name": "-no_content_verify",
                        "lines": 2
                    },
                    {
                        "name": "-no_attr_verify",
                        "lines": 2
                    },
                    {
                        "name": "-nosigs",
                        "lines": 2
                    },
                    {
                        "name": "-noverify",
                        "lines": 2
                    },
                    {
                        "name": "-nointern",
                        "lines": 6
                    },
                    {
                        "name": "-cades",
                        "lines": 3
                    },
                    {
                        "name": "-verify_retcode",
                        "lines": 3
                    },
                    {
                        "name": "-no-CAstore",
                        "lines": 4
                    },
                    {
                        "name": "-keyid",
                        "lines": 10
                    },
                    {
                        "name": "-text",
                        "lines": 9
                    },
                    {
                        "name": "-to, -from, -subject",
                        "lines": 6
                    },
                    {
                        "name": "-noout",
                        "lines": 3
                    },
                    {
                        "name": "-print",
                        "lines": 9
                    },
                    {
                        "name": "-receipt_request_print",
                        "lines": 9
                    },
                    {
                        "name": "-verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict",
                        "lines": 1
                    },
                    {
                        "name": "-issuer_checks",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 74,
                "subsections": []
            },
            {
                "name": "EXIT CODES",
                "lines": 35,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 95,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "openssl-cms - CMS command\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "openssl cms [-help]\n\nGeneral options:\n\n[-in filename] [-out filename] [-config configfile]\n\nOperation options:\n\n[-encrypt] [-decrypt] [-sign] [-verify] [-resign] [-signreceipt]\n[-verifyreceipt receipt] [-digestcreate] [-digestverify] [-compress]\n[-uncompress] [-EncryptedDataencrypt] [-EncryptedDatadecrypt]\n[-datacreate] [-dataout] [-cmsout]\n\nFile format options:\n\n[-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform\nDER|PEM|SMIME] [-stream] [-indef] [-noindef] [-binary] [-crlfeol]\n[-asciicrlf]\n\nKeys and password options:\n\n[-pwripassword password] [-secretkey key] [-secretkeyid id] [-inkey\nfilename|uri] [-passin arg] [-keyopt name:parameter] [-keyform\nDER|PEM|P12|ENGINE] [-engine id] [-provider name] [-provider-path path]\n[-propquery propq] [-rand files] [-writerand file]\n\nEncryption options:\n\n[-originator file] [-recip file] [recipient-cert ...]  [-cipher] [-wrap\ncipher] [-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap]\n[-debugdecrypt]\n\nSigning options:\n\n[-md digest] [-signer file] [-certfile file] [-cades] [-nodetach]\n[-nocerts] [-noattr] [-nosmimecap] [-receiptrequestall]\n[-receiptrequestfirst] [-receiptrequestfrom emailaddress]\n[-receiptrequestto emailaddress]\n\nVerification options:\n\n[-signer file] [-content filename] [-nocontentverify]\n[-noattrverify] [-nosigs] [-noverify] [-nointern] [-cades]\n[-verifyretcode] [-CAfile file] [-no-CAfile] [-CApath dir]\n[-no-CApath] [-CAstore uri] [-no-CAstore]\n\nOutput options:\n\n[-keyid] [-econtenttype type] [-text] [-certsout file] [-to addr]\n[-from addr] [-subject subj]\n\nPrinting options:\n\n[-noout] [-print] [-nameopt option] [-receiptrequestprint]\n\nValidation options:\n\n[-allowproxycerts] [-attime timestamp] [-nochecktime]\n[-checksssig] [-crlcheck] [-crlcheckall] [-explicitpolicy]\n[-extendedcrl] [-ignorecritical] [-inhibitany] [-inhibitmap]\n[-partialchain] [-policy arg] [-policycheck] [-policyprint]\n[-purpose purpose] [-suiteB128] [-suiteB128only] [-suiteB192]\n[-trustedfirst] [-noaltchains] [-usedeltas] [-authlevel num]\n[-verifydepth num] [-verifyemail email] [-verifyhostname hostname]\n[-verifyip ip] [-verifyname name] [-x509strict] [-issuerchecks]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This command handles data in CMS format such as S/MIME v3.1 email\nmessages.  It can encrypt, decrypt, sign, verify, compress, uncompress,\nand print messages.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "There are a number of operation options that set the type of operation\nto be performed: encrypt, decrypt, sign, verify, resign, signreceipt,\nverifyreceipt, digestcreate, digestverify, compress, uncompress,\nEncryptedDataencrypt, EncryptedDatadecrypt, datacreate, dataout, or\ncmsout.  The relevance of the other options depends on the operation\ntype and their meaning may vary according to it.\n",
                "subsections": [
                    {
                        "name": "-help",
                        "content": "Print out a usage message.\n\nGeneral options\n-in filename\nThe input message to be encrypted or signed or the message to be\ndecrypted or verified.\n\n-out filename\nThe message text that has been decrypted or verified or the output\nMIME format message that has been signed or verified.\n\n-config configfile\nSee \"Configuration Option\" in openssl(1).\n\nOperation options"
                    },
                    {
                        "name": "-encrypt",
                        "content": "Encrypt data for the given recipient certificates. Input file is\nthe message to be encrypted. The output file is the encrypted data\nin MIME format. The actual CMS type is EnvelopedData.\n\nNote that no revocation check is done for the recipient cert, so if\nthat key has been compromised, others may be able to decrypt the\ntext.\n"
                    },
                    {
                        "name": "-decrypt",
                        "content": "Decrypt data using the supplied certificate and private key.\nExpects encrypted datain MIME format for the input file. The\ndecrypted data is written to the output file.\n"
                    },
                    {
                        "name": "-sign",
                        "content": "Sign data using the supplied certificate and private key. Input\nfile is the message to be signed. The signed data in MIME format is\nwritten to the output file.\n"
                    },
                    {
                        "name": "-verify",
                        "content": "Verify signed data. Expects a signed data on input and outputs the\nsigned data. Both clear text and opaque signing is supported.\n"
                    },
                    {
                        "name": "-resign",
                        "content": "Resign a message: take an existing message and one or more new\nsigners.\n"
                    },
                    {
                        "name": "-sign_receipt",
                        "content": "Generate and output a signed receipt for the supplied message. The\ninput message must contain a signed receipt request. Functionality\nis otherwise similar to the -sign operation.\n\n-verifyreceipt receipt\nVerify a signed receipt in filename receipt. The input message must\ncontain the original receipt request. Functionality is otherwise\nsimilar to the -verify operation.\n"
                    },
                    {
                        "name": "-digest_create",
                        "content": "Create a CMS DigestedData type.\n"
                    },
                    {
                        "name": "-digest_verify",
                        "content": "Verify a CMS DigestedData type and output the content.\n"
                    },
                    {
                        "name": "-compress",
                        "content": "Create a CMS CompressedData type. OpenSSL must be compiled with\nzlib support for this option to work, otherwise it will output an\nerror.\n"
                    },
                    {
                        "name": "-uncompress",
                        "content": "Uncompress a CMS CompressedData type and output the content.\nOpenSSL must be compiled with zlib support for this option to work,\notherwise it will output an error.\n"
                    },
                    {
                        "name": "-EncryptedData_encrypt",
                        "content": "Encrypt content using supplied symmetric key and algorithm using a\nCMS EncryptedData type and output the content.\n"
                    },
                    {
                        "name": "-EncryptedData_decrypt",
                        "content": "Decrypt content using supplied symmetric key and algorithm using a\nCMS EncryptedData type and output the content.\n"
                    },
                    {
                        "name": "-data_create",
                        "content": "Create a CMS Data type.\n"
                    },
                    {
                        "name": "-data_out",
                        "content": "Data type and output the content.\n"
                    },
                    {
                        "name": "-cmsout",
                        "content": "Takes an input message and writes out a PEM encoded CMS structure.\n\nFile format options\n-inform DER|PEM|SMIME\nThe input format of the CMS structure (if one is being read); the\ndefault is SMIME.  See openssl-format-options(1) for details.\n\n-outform DER|PEM|SMIME\nThe output format of the CMS structure (if one is being written);\nthe default is SMIME.  See openssl-format-options(1) for details.\n\n-rctform DER|PEM|SMIME\nThe signed receipt format for use with the -receiptverify; the\ndefault is SMIME.  See openssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-stream, -indef",
                        "content": "The -stream and -indef options are equivalent and enable streaming\nI/O for encoding operations. This permits single pass processing of\ndata without the need to hold the entire contents in memory,\npotentially supporting very large files. Streaming is automatically\nset for S/MIME signing with detached data if the output format is\nSMIME it is currently off by default for all other operations.\n"
                    },
                    {
                        "name": "-noindef",
                        "content": "Disable streaming I/O where it would produce and indefinite length\nconstructed encoding. This option currently has no effect. In\nfuture streaming will be enabled by default on all relevant\noperations and this option will disable it.\n"
                    },
                    {
                        "name": "-binary",
                        "content": "Normally the input message is converted to \"canonical\" format which\nis effectively using CR and LF as end of line: as required by the\nS/MIME specification. When this option is present no translation\noccurs. This is useful when handling binary data which may not be\nin MIME format.\n"
                    },
                    {
                        "name": "-crlfeol",
                        "content": "Normally the output file uses a single LF as end of line. When this\noption is present CRLF is used instead.\n"
                    },
                    {
                        "name": "-asciicrlf",
                        "content": "When signing use ASCII CRLF format canonicalisation. This strips\ntrailing whitespace from all lines, deletes trailing blank lines at\nEOF and sets the encapsulated content type. This option is normally\nused with detached content and an output signature format of DER.\nThis option is not normally needed when verifying as it is enabled\nautomatically if the encapsulated content format is detected.\n\nKeys and password options\n-pwripassword password\nSpecify password for recipient.\n\n-secretkey key\nSpecify symmetric key to use. The key must be supplied in hex\nformat and be consistent with the algorithm used. Supported by the\n-EncryptedDataencrypt -EncryptedDatadecrypt, -encrypt and\n-decrypt options. When used with -encrypt or -decrypt the supplied\nkey is used to wrap or unwrap the content encryption key using an\nAES key in the KEKRecipientInfo type.\n\n-secretkeyid id\nThe key identifier for the supplied symmetric key for\nKEKRecipientInfo type.  This option must be present if the\n-secretkey option is used with -encrypt. With -decrypt operations\nthe id is used to locate the relevant key if it is not supplied\nthen an attempt is used to decrypt any KEKRecipientInfo structures.\n\n-inkey filename|uri\nThe private key to use when signing or decrypting. This must match\nthe corresponding certificate. If this option is not specified then\nthe private key must be included in the certificate file specified\nwith the -recip or -signer file. When signing this option can be\nused multiple times to specify successive keys.\n\n-passin arg\nThe private key password source. For more information about the\nformat of arg see openssl-passphrase-options(1).\n\n-keyopt name:parameter\nFor signing and encryption this option can be used multiple times\nto set customised parameters for the preceding key or certificate.\nIt can currently be used to set RSA-PSS for signing, RSA-OAEP for\nencryption or to modify default parameters for ECDH.\n\n-keyform DER|PEM|P12|ENGINE\nThe format of the private key file; unspecified by default.  See\nopenssl-format-options(1) for details.\n\n-engine id\nSee \"Engine Options\" in openssl(1).  This option is deprecated.\n\n-provider name\n-provider-path path\n-propquery propq\nSee \"Provider Options\" in openssl(1), provider(7), and property(7).\n\n-rand files, -writerand file\nSee \"Random State Options\" in openssl(1) for details.\n\nEncryption and decryption options\n-originator file\nA certificate of the originator of the encrypted message. Necessary\nfor decryption when Key Agreement is in use for a shared key.\n\n-recip file\nWhen decrypting a message this specifies the certificate of the\nrecipient.  The certificate must match one of the recipients of the\nmessage.\n\nWhen encrypting a message this option may be used multiple times to\nspecify each recipient. This form must be used if customised\nparameters are required (for example to specify RSA-OAEP).\n\nOnly certificates carrying RSA, Diffie-Hellman or EC keys are\nsupported by this option.\n\nrecipient-cert ...\nThis is an alternative to using the -recip option when encrypting a\nmessage.  One or more certificate filennames may be given.\n"
                    },
                    {
                        "name": "-cipher",
                        "content": "The encryption algorithm to use. For example triple DES (168 bits)\n- -des3 or 256 bit AES - -aes256. Any standard algorithm name (as\nused by the EVPgetcipherbyname() function) can also be used\npreceded by a dash, for example -aes-128-cbc. See openssl-enc(1)\nfor a list of ciphers supported by your version of OpenSSL.\n\nCurrently the AES variants with GCM mode are the only supported\nAEAD algorithms.\n\nIf not specified triple DES is used. Only used with -encrypt and\n-EncryptedDatacreate commands.\n\n-wrap cipher\nCipher algorithm to use for key wrap when encrypting the message\nusing Key Agreement for key transport. The algorithm specified\nshould be suitable for key wrap.\n"
                    },
                    {
                        "name": "-aes128-wrap, -aes192-wrap, -aes256-wrap, -des3-wrap",
                        "content": "Use AES128, AES192, AES256, or 3DES-EDE, respectively, to wrap key.\nDepending on the OpenSSL build options used, -des3-wrap may not be\nsupported.\n"
                    },
                    {
                        "name": "-debug_decrypt",
                        "content": "This option sets the CMSDEBUGDECRYPT flag. This option should be\nused with caution: see the notes section below.\n\nSigning options\n-md digest\nDigest algorithm to use when signing or resigning. If not present\nthen the default digest algorithm for the signing key will be used\n(usually SHA1).\n\n-signer file\nA signing certificate.  When signing or resigning a message, this\noption can be used multiple times if more than one signer is\nrequired.\n\n-certfile file\nAllows additional certificates to be specified. When signing these\nwill be included with the message. When verifying these will be\nsearched for the signers certificates.  The input can be in PEM,\nDER, or PKCS#12 format.\n"
                    },
                    {
                        "name": "-cades",
                        "content": "When used with -sign, add an ESS signingCertificate or ESS\nsigningCertificateV2 signed-attribute to the SignerInfo, in order\nto make the signature comply with the requirements for a CAdES\nBasic Electronic Signature (CAdES-BES).\n"
                    },
                    {
                        "name": "-nodetach",
                        "content": "When signing a message use opaque signing: this form is more\nresistant to translation by mail relays but it cannot be read by\nmail agents that do not support S/MIME.  Without this option\ncleartext signing with the MIME type multipart/signed is used.\n"
                    },
                    {
                        "name": "-nocerts",
                        "content": "When signing a message the signer's certificate is normally\nincluded with this option it is excluded. This will reduce the size\nof the signed message but the verifier must have a copy of the\nsigners certificate available locally (passed using the -certfile\noption for example).\n"
                    },
                    {
                        "name": "-noattr",
                        "content": "Normally when a message is signed a set of attributes are included\nwhich include the signing time and supported symmetric algorithms.\nWith this option they are not included.\n"
                    },
                    {
                        "name": "-nosmimecap",
                        "content": "Exclude the list of supported algorithms from signed attributes,\nother options such as signing time and content type are still\nincluded.\n"
                    },
                    {
                        "name": "-receipt_request_all, -receipt_request_first",
                        "content": "For -sign option include a signed receipt request. Indicate\nrequests should be provided by all recipient or first tier\nrecipients (those mailed directly and not from a mailing list).\nIgnored it -receiptrequestfrom is included.\n\n-receiptrequestfrom emailaddress\nFor -sign option include a signed receipt request. Add an explicit\nemail address where receipts should be supplied.\n\n-receiptrequestto emailaddress\nAdd an explicit email address where signed receipts should be sent\nto. This option must but supplied if a signed receipt is requested.\n\nVerification options\n-signer file\nIf a message has been verified successfully then the signers\ncertificate(s) will be written to this file if the verification was\nsuccessful.\n\n-content filename\nThis specifies a file containing the detached content for\noperations taking S/MIME input, such as the -verify command. This\nis only usable if the CMS structure is using the detached signature\nform where the content is not included. This option will override\nany content if the input format is S/MIME and it uses the\nmultipart/signed MIME content type.\n"
                    },
                    {
                        "name": "-no_content_verify",
                        "content": "Do not verify signed content signatures.\n"
                    },
                    {
                        "name": "-no_attr_verify",
                        "content": "Do not verify signed attribute signatures.\n"
                    },
                    {
                        "name": "-nosigs",
                        "content": "Don't verify message signature.\n"
                    },
                    {
                        "name": "-noverify",
                        "content": "Do not verify the signers certificate of a signed message.\n"
                    },
                    {
                        "name": "-nointern",
                        "content": "When verifying a message normally certificates (if any) included in\nthe message are searched for the signing certificate. With this\noption only the certificates specified in the -certfile option are\nused.  The supplied certificates can still be used as untrusted CAs\nhowever.\n"
                    },
                    {
                        "name": "-cades",
                        "content": "When used with -verify, require and check signer certificate\ndigest.  See the NOTES section for more details.\n"
                    },
                    {
                        "name": "-verify_retcode",
                        "content": "Exit nonzero on verification failure.\n\n-CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri,"
                    },
                    {
                        "name": "-no-CAstore",
                        "content": "See \"Trusted Certificate Options\" in\nopenssl-verification-options(1) for details.\n\nOutput options"
                    },
                    {
                        "name": "-keyid",
                        "content": "Use subject key identifier to identify certificates instead of\nissuer name and serial number. The supplied certificate must\ninclude a subject key identifier extension. Supported by -sign and\n-encrypt options.\n\n-econtenttype type\nSet the encapsulated content type to type if not supplied the Data\ntype is used. The type argument can be any valid OID name in either\ntext or numerical format.\n"
                    },
                    {
                        "name": "-text",
                        "content": "This option adds plain text (text/plain) MIME headers to the\nsupplied message if encrypting or signing. If decrypting or\nverifying it strips off text headers: if the decrypted or verified\nmessage is not of MIME type text/plain then an error occurs.\n\n-certsout file\nAny certificates contained in the input message are written to\nfile.\n"
                    },
                    {
                        "name": "-to, -from, -subject",
                        "content": "The relevant email headers. These are included outside the signed\nportion of a message so they may be included manually. If signing\nthen many S/MIME mail clients check the signers certificate's email\naddress matches that specified in the From: address.\n\nPrinting options"
                    },
                    {
                        "name": "-noout",
                        "content": "For the -cmsout operation do not output the parsed CMS structure.\nThis is useful if the syntax of the CMS structure is being checked.\n"
                    },
                    {
                        "name": "-print",
                        "content": "For the -cmsout operation print out all fields of the CMS\nstructure.  This implies -noout.  This is mainly useful for testing\npurposes.\n\n-nameopt option\nFor the -cmsout operation when -print option is in use, specifies\nprinting options for string fields. For most cases utf8 is\nreasonable value.  See openssl-namedisplay-options(1) for details.\n"
                    },
                    {
                        "name": "-receipt_request_print",
                        "content": "For the -verify operation print out the contents of any signed\nreceipt requests.\n\nValidation options\n-allowproxycerts, -attime, -nochecktime, -checksssig, -crlcheck,\n-crlcheckall, -explicitpolicy, -extendedcrl, -ignorecritical,\n-inhibitany, -inhibitmap, -noaltchains, -partialchain, -policy,\n-policycheck, -policyprint, -purpose, -suiteB128, -suiteB128only,\n-suiteB192, -trustedfirst, -usedeltas, -authlevel, -verifydepth,"
                    },
                    {
                        "name": "-verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict",
                        "content": ""
                    },
                    {
                        "name": "-issuer_checks",
                        "content": "Set various options of certificate chain verification.  See\n\"Verification Options\" in openssl-verification-options(1) for\ndetails.\n\nAny validation errors cause the command to exit.\n"
                    }
                ]
            },
            "NOTES": {
                "content": "The MIME message must be sent without any blank lines between the\nheaders and the output. Some mail programs will automatically add a\nblank line. Piping the mail directly to sendmail is one way to achieve\nthe correct format.\n\nThe supplied message to be signed or encrypted must include the\nnecessary MIME headers or many S/MIME clients won't display it properly\n(if at all). You can use the -text option to automatically add plain\ntext headers.\n\nA \"signed and encrypted\" message is one where a signed message is then\nencrypted. This can be produced by encrypting an already signed\nmessage: see the examples section.\n\nThis version of the program only allows one signer per message but it\nwill verify multiple signers on received messages. Some S/MIME clients\nchoke if a message contains multiple signers. It is possible to sign\nmessages \"in parallel\" by signing an already signed message.\n\nThe options -encrypt and -decrypt reflect common usage in S/MIME\nclients. Strictly speaking these process CMS enveloped data: CMS\nencrypted data is used for other purposes.\n\nThe -resign option uses an existing message digest when adding a new\nsigner. This means that attributes must be present in at least one\nexisting signer using the same message digest or this operation will\nfail.\n\nThe -stream and -indef options enable streaming I/O support.  As a\nresult the encoding is BER using indefinite length constructed encoding\nand no longer DER. Streaming is supported for the -encrypt operation\nand the -sign operation if the content is not detached.\n\nStreaming is always used for the -sign operation with detached data but\nsince the content is no longer part of the CMS structure the encoding\nremains DER.\n\nIf the -decrypt option is used without a recipient certificate then an\nattempt is made to locate the recipient by trying each potential\nrecipient in turn using the supplied private key. To thwart the MMA\nattack (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all\nrecipients are tried whether they succeed or not and if no recipients\nmatch the message is \"decrypted\" using a random key which will\ntypically output garbage.  The -debugdecrypt option can be used to\ndisable the MMA attack protection and return an error if no recipient\ncan be found: this option should be used with caution. For a fuller\ndescription see CMSdecrypt(3)).\n\nCADES BASIC ELECTRONIC SIGNATURE (CADES-BES)\nA CAdES Basic Electronic Signature (CAdES-BES), as defined in the\nEuropean Standard ETSI EN 319 122-1 V1.1.1, contains:\n\no   The signed user data as defined in CMS (RFC 3852);\n\no   Content-type of the EncapsulatedContentInfo value being signed;\n\no   Message-digest of the eContent OCTET STRING within encapContentInfo\nbeing signed;\n\no   An ESS signingCertificate or ESS signingCertificateV2 attribute, as\ndefined in Enhanced Security Services (ESS), RFC 2634 and RFC 5035.\nAn ESS signingCertificate attribute only allows for SHA-1 as digest\nalgorithm.  An ESS signingCertificateV2 attribute allows for any\ndigest algorithm.\n\no   The digital signature value computed on the user data and, when\npresent, on the signed attributes.\n\nNOTE that the -cades option applies to the -sign or -verify\noperations.  With this option, the -verify operation also requires\nthat the signingCertificate attribute is present and checks that\nthe given identifiers match the verification trust chain built\nduring the verification process.\n",
                "subsections": []
            },
            "EXIT CODES": {
                "content": "0   The operation was completely successfully.\n\n1   An error occurred parsing the command options.\n\n2   One of the input files could not be read.\n\n3   An error occurred creating the CMS file or when reading the MIME\nmessage.\n\n4   An error occurred decrypting or verifying the message.\n\n5   The message was verified correctly but an error occurred writing\nout the signers certificates.\n\nCOMPATIBILITY WITH PKCS#7 FORMAT\nopenssl-smime(1) can only process the older PKCS#7 format.  openssl cms\nsupports Cryptographic Message Syntax format.  Use of some features\nwill result in messages which cannot be processed by applications which\nonly support the older format. These are detailed below.\n\nThe use of the -keyid option with -sign or -encrypt.\n\nThe -outform PEM option uses different headers.\n\nThe -compress option.\n\nThe -secretkey option when used with -encrypt.\n\nThe use of PSS with -sign.\n\nThe use of OAEP or non-RSA keys with -encrypt.\n\nAdditionally the -EncryptedDatacreate and -datacreate type cannot be\nprocessed by the older openssl-smime(1) command.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "Create a cleartext signed message:\n\nopenssl cms -sign -in message.txt -text -out mail.msg \\\n-signer mycert.pem\n\nCreate an opaque signed message\n\nopenssl cms -sign -in message.txt -text -out mail.msg -nodetach \\\n-signer mycert.pem\n\nCreate a signed message, include some additional certificates and read\nthe private key from another file:\n\nopenssl cms -sign -in in.txt -text -out mail.msg \\\n-signer mycert.pem -inkey mykey.pem -certfile mycerts.pem\n\nCreate a signed message with two signers, use key identifier:\n\nopenssl cms -sign -in message.txt -text -out mail.msg \\\n-signer mycert.pem -signer othercert.pem -keyid\n\nSend a signed message under Unix directly to sendmail, including\nheaders:\n\nopenssl cms -sign -in in.txt -text -signer mycert.pem \\\n-from steve@openssl.org -to someone@somewhere \\\n-subject \"Signed message\" | sendmail someone@somewhere\n\nVerify a message and extract the signer's certificate if successful:\n\nopenssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt\n\nSend encrypted mail using triple DES:\n\nopenssl cms -encrypt -in in.txt -from steve@openssl.org \\\n-to someone@somewhere -subject \"Encrypted message\" \\\n-des3 user.pem -out mail.msg\n\nSign and encrypt mail:\n\nopenssl cms -sign -in ml.txt -signer my.pem -text \\\n| openssl cms -encrypt -out mail.msg \\\n-from steve@openssl.org -to someone@somewhere \\\n-subject \"Signed and Encrypted message\" -des3 user.pem\n\nNote: the encryption command does not include the -text option because\nthe message being encrypted already has MIME headers.\n\nDecrypt a message:\n\nopenssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem\n\nThe output from Netscape form signing is a PKCS#7 structure with the\ndetached signature format. You can use this program to verify the\nsignature by line wrapping the base64 encoded structure and surrounding\nit with:\n\n-----BEGIN PKCS7-----\n-----END PKCS7-----\n\nand using the command,\n\nopenssl cms -verify -inform PEM -in signature.pem -content content.txt\n\nalternatively you can base64 decode the signature and use\n\nopenssl cms -verify -inform DER -in signature.der -content content.txt\n\nCreate an encrypted message using 128 bit Camellia:\n\nopenssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem\n\nAdd a signer to an existing message:\n\nopenssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg\n\nSign a message using RSA-PSS:\n\nopenssl cms -sign -in message.txt -text -out mail.msg \\\n-signer mycert.pem -keyopt rsapaddingmode:pss\n\nCreate an encrypted message using RSA-OAEP:\n\nopenssl cms -encrypt -in plain.txt -out mail.msg \\\n-recip cert.pem -keyopt rsapaddingmode:oaep\n\nUse SHA256 KDF with an ECDH certificate:\n\nopenssl cms -encrypt -in plain.txt -out mail.msg \\\n-recip ecdhcert.pem -keyopt ecdhkdfmd:sha256\n\nPrint CMS signed binary data in human-readable form:\n\nopenssl cms -in signed.cms -binary -inform DER -cmsout -print\n",
                "subsections": []
            },
            "BUGS": {
                "content": "The MIME parser isn't very clever: it seems to handle most messages\nthat I've thrown at it but it may choke on others.\n\nThe code currently will only write out the signer's certificate to a\nfile: if the signer has a separate encryption certificate this must be\nmanually extracted. There should be some heuristic that determines the\ncorrect encryption certificate.\n\nIdeally a database should be maintained of a certificates for each\nemail address.\n\nThe code doesn't currently take note of the permitted symmetric\nencryption algorithms as supplied in the SMIMECapabilities signed\nattribute. this means the user has to manually include the correct\nencryption algorithm. It should store the list of permitted ciphers in\na database and only use those.\n\nNo revocation checking is done on the signer's certificate.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "osslstore-file(7)\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "The use of multiple -signer options and the -resign command were first\nadded in OpenSSL 1.0.0.\n\nThe -keyopt option was added in OpenSSL 1.0.2.\n\nSupport for RSA-OAEP and RSA-PSS was added in OpenSSL 1.0.2.\n\nThe use of non-RSA keys with -encrypt and -decrypt was added in OpenSSL\n1.0.2.\n\nThe -noaltchains option was added in OpenSSL 1.0.2b.\n\nThe -nameopt option was added in OpenSSL 3.0.0.\n\nThe -engine option was deprecated in OpenSSL 3.0.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed under the Apache License 2.0 (the \"License\").  You may not use\nthis file except in compliance with the License.  You can obtain a copy\nin the file LICENSE in the source distribution or at\n<https://www.openssl.org/source/license.html>.\n\n3.0.2                             2026-06-02                 OPENSSL-CMS(1SSL)",
                "subsections": []
            }
        }
    }
}