{
    "content": [
        {
            "type": "text",
            "text": "# OPENSSL-CMS (man)\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] [-verifyreceipt receipt]\n[-digestcreate] [-digestverify] [-compress] [-uncompress] [-EncryptedDataencrypt]\n[-EncryptedDatadecrypt] [-datacreate] [-dataout] [-cmsout]\nFile format options:\n[-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform DER|PEM|SMIME] [-stream] [-indef]\n[-noindef] [-binary] [-crlfeol] [-asciicrlf]\nKeys and password options:\n[-pwripassword password] [-secretkey key] [-secretkeyid id] [-inkey filename|uri] [-passin\narg] [-keyopt name:parameter] [-keyform DER|PEM|P12|ENGINE] [-engine id] [-provider name]\n[-provider-path path] [-propquery propq] [-rand files] [-writerand file]\nEncryption options:\n[-originator file] [-recip file] [recipient-cert ...]  [-cciipphheerr] [-wrap cipher]\n[-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap] [-debugdecrypt]\nSigning options:\n[-md digest] [-signer file] [-certfile file] [-cades] [-nodetach] [-nocerts] [-noattr]\n[-nosmimecap] [-receiptrequestall] [-receiptrequestfirst] [-receiptrequestfrom\nemailaddress] [-receiptrequestto emailaddress]\nVerification options:\n[-signer file] [-content filename] [-nocontentverify] [-noattrverify] [-nosigs]\n[-noverify] [-nointern] [-cades] [-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] [-from addr] [-subject\nsubj]\nPrinting options:\n[-noout] [-print] [-nameopt option] [-receiptrequestprint]\nValidation options:\n[-allowproxycerts] [-attime timestamp] [-nochecktime] [-checksssig] [-crlcheck]\n[-crlcheckall] [-explicitpolicy] [-extendedcrl] [-ignorecritical] [-inhibitany]\n[-inhibitmap] [-partialchain] [-policy arg] [-policycheck] [-policyprint] [-purpose\npurpose] [-suiteB128] [-suiteB128only] [-suiteB192] [-trustedfirst] [-noaltchains]\n[-usedeltas] [-authlevel num] [-verifydepth num] [-verifyemail email] [-verifyhostname\nhostname] [-verifyip ip] [-verifyname name] [-x509strict] [-issuerchecks]\n\n## DESCRIPTION\n\nThis command handles data in CMS format such as S/MIME v3.1 email messages.  It can encrypt,\ndecrypt, sign, verify, compress, uncompress, and print messages.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (90 subsections)\n- **NOTES** (1 subsections)\n- **EXIT CODES** (1 subsections)\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": "man",
        "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] [-verifyreceipt receipt]\n[-digestcreate] [-digestverify] [-compress] [-uncompress] [-EncryptedDataencrypt]\n[-EncryptedDatadecrypt] [-datacreate] [-dataout] [-cmsout]\nFile format options:\n[-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform DER|PEM|SMIME] [-stream] [-indef]\n[-noindef] [-binary] [-crlfeol] [-asciicrlf]\nKeys and password options:\n[-pwripassword password] [-secretkey key] [-secretkeyid id] [-inkey filename|uri] [-passin\narg] [-keyopt name:parameter] [-keyform DER|PEM|P12|ENGINE] [-engine id] [-provider name]\n[-provider-path path] [-propquery propq] [-rand files] [-writerand file]\nEncryption options:\n[-originator file] [-recip file] [recipient-cert ...]  [-cciipphheerr] [-wrap cipher]\n[-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap] [-debugdecrypt]\nSigning options:\n[-md digest] [-signer file] [-certfile file] [-cades] [-nodetach] [-nocerts] [-noattr]\n[-nosmimecap] [-receiptrequestall] [-receiptrequestfirst] [-receiptrequestfrom\nemailaddress] [-receiptrequestto emailaddress]\nVerification options:\n[-signer file] [-content filename] [-nocontentverify] [-noattrverify] [-nosigs]\n[-noverify] [-nointern] [-cades] [-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] [-from addr] [-subject\nsubj]\nPrinting options:\n[-noout] [-print] [-nameopt option] [-receiptrequestprint]\nValidation options:\n[-allowproxycerts] [-attime timestamp] [-nochecktime] [-checksssig] [-crlcheck]\n[-crlcheckall] [-explicitpolicy] [-extendedcrl] [-ignorecritical] [-inhibitany]\n[-inhibitmap] [-partialchain] [-policy arg] [-policycheck] [-policyprint] [-purpose\npurpose] [-suiteB128] [-suiteB128only] [-suiteB192] [-trustedfirst] [-noaltchains]\n[-usedeltas] [-authlevel num] [-verifydepth num] [-verifyemail email] [-verifyhostname\nhostname] [-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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The input message to be encrypted or signed or the message to be decrypted or verified."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The message text that has been decrypted or verified or the output MIME format message that has been signed or verified."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Configuration Option\" in openssl(1)."
            },
            {
                "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The input format of the CMS structure (if one is being read); the default is SMIME. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The output format of the CMS structure (if one is being written); the default is SMIME. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Specify password for recipient."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The private key password source. For more information about the format of arg see openssl-passphrase-options(1)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The format of the private key file; unspecified by default. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Engine Options\" in openssl(1). This option is deprecated."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Provider Options\" in openssl(1), provider(7), and property(7)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Random State Options\" in openssl(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "A certificate of the originator of the encrypted message. Necessary for decryption when Key Agreement is in use for a shared key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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. -cciipphheerr 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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "A signing certificate. When signing or resigning a message, this option can be used multiple times if more than one signer is required."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "For -sign option include a signed receipt request. Add an explicit email address where receipts should be supplied."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Add an explicit email address where signed receipts should be sent to. This option must but supplied if a signed receipt is requested."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "If a message has been verified successfully then the signers certificate(s) will be written to this file if the verification was successful."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Trusted Certificate Options\" in openssl-verification-options(1) for details."
            },
            {
                "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "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": 58,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 6,
                "subsections": [
                    {
                        "name": "-help",
                        "lines": 2
                    },
                    {
                        "name": "General options",
                        "lines": 1
                    },
                    {
                        "name": "-in",
                        "lines": 2
                    },
                    {
                        "name": "-out",
                        "lines": 3
                    },
                    {
                        "name": "-config",
                        "lines": 2
                    },
                    {
                        "name": "Operation options",
                        "lines": 1
                    },
                    {
                        "name": "-encrypt",
                        "lines": 7
                    },
                    {
                        "name": "-decrypt",
                        "lines": 3
                    },
                    {
                        "name": "-sign",
                        "lines": 3
                    },
                    {
                        "name": "-verify",
                        "lines": 3
                    },
                    {
                        "name": "-resign",
                        "lines": 2
                    },
                    {
                        "name": "-sign",
                        "lines": 4
                    },
                    {
                        "name": "-verify",
                        "lines": 3
                    },
                    {
                        "name": "-digest",
                        "lines": 2
                    },
                    {
                        "name": "-digest",
                        "lines": 2
                    },
                    {
                        "name": "-compress",
                        "lines": 3
                    },
                    {
                        "name": "-uncompress",
                        "lines": 3
                    },
                    {
                        "name": "-EncryptedData",
                        "lines": 3
                    },
                    {
                        "name": "-EncryptedData",
                        "lines": 3
                    },
                    {
                        "name": "-data",
                        "lines": 2
                    },
                    {
                        "name": "-data",
                        "lines": 2
                    },
                    {
                        "name": "-cmsout",
                        "lines": 2
                    },
                    {
                        "name": "File format options",
                        "lines": 1
                    },
                    {
                        "name": "-inform",
                        "lines": 3
                    },
                    {
                        "name": "-outform",
                        "lines": 3
                    },
                    {
                        "name": "-rctform",
                        "lines": 3
                    },
                    {
                        "name": "-stream -indef",
                        "lines": 6
                    },
                    {
                        "name": "-noindef",
                        "lines": 4
                    },
                    {
                        "name": "-binary",
                        "lines": 5
                    },
                    {
                        "name": "-crlfeol",
                        "lines": 3
                    },
                    {
                        "name": "-asciicrlf",
                        "lines": 6
                    },
                    {
                        "name": "Keys and password options",
                        "lines": 1
                    },
                    {
                        "name": "-pwri",
                        "lines": 2
                    },
                    {
                        "name": "-secretkey",
                        "lines": 6
                    },
                    {
                        "name": "-secretkeyid",
                        "lines": 5
                    },
                    {
                        "name": "-inkey",
                        "lines": 5
                    },
                    {
                        "name": "-passin",
                        "lines": 3
                    },
                    {
                        "name": "-keyopt",
                        "lines": 4
                    },
                    {
                        "name": "-keyform",
                        "lines": 3
                    },
                    {
                        "name": "-engine",
                        "lines": 2
                    },
                    {
                        "name": "-provider",
                        "lines": 1
                    },
                    {
                        "name": "-provider-path",
                        "lines": 1
                    },
                    {
                        "name": "-propquery",
                        "lines": 2
                    },
                    {
                        "name": "-rand -writerand",
                        "lines": 2
                    },
                    {
                        "name": "Encryption and decryption options",
                        "lines": 1
                    },
                    {
                        "name": "-originator",
                        "lines": 3
                    },
                    {
                        "name": "-recip",
                        "lines": 24
                    },
                    {
                        "name": "-wrap",
                        "lines": 3
                    },
                    {
                        "name": "-aes128-wrap -aes192-wrap -aes256-wrap -des3-wrap",
                        "lines": 3
                    },
                    {
                        "name": "-debug",
                        "lines": 3
                    },
                    {
                        "name": "Signing options",
                        "lines": 1
                    },
                    {
                        "name": "-md",
                        "lines": 3
                    },
                    {
                        "name": "-signer",
                        "lines": 3
                    },
                    {
                        "name": "-certfile",
                        "lines": 4
                    },
                    {
                        "name": "-cades",
                        "lines": 4
                    },
                    {
                        "name": "-nodetach",
                        "lines": 4
                    },
                    {
                        "name": "-nocerts",
                        "lines": 5
                    },
                    {
                        "name": "-noattr",
                        "lines": 3
                    },
                    {
                        "name": "-nosmimecap",
                        "lines": 3
                    },
                    {
                        "name": "-receipt -receipt",
                        "lines": 4
                    },
                    {
                        "name": "-receipt",
                        "lines": 3
                    },
                    {
                        "name": "-receipt",
                        "lines": 3
                    },
                    {
                        "name": "Verification options",
                        "lines": 1
                    },
                    {
                        "name": "-signer",
                        "lines": 3
                    },
                    {
                        "name": "-content",
                        "lines": 5
                    },
                    {
                        "name": "-no",
                        "lines": 2
                    },
                    {
                        "name": "-no",
                        "lines": 2
                    },
                    {
                        "name": "-nosigs",
                        "lines": 2
                    },
                    {
                        "name": "-noverify",
                        "lines": 2
                    },
                    {
                        "name": "-nointern",
                        "lines": 5
                    },
                    {
                        "name": "-cades",
                        "lines": 3
                    },
                    {
                        "name": "-verify",
                        "lines": 2
                    },
                    {
                        "name": "-CAfile -no-CAfile -CApath -no-CApath -CAstore -no-CAstore",
                        "lines": 2
                    },
                    {
                        "name": "Output options",
                        "lines": 1
                    },
                    {
                        "name": "-keyid",
                        "lines": 4
                    },
                    {
                        "name": "-econtent",
                        "lines": 3
                    },
                    {
                        "name": "-text",
                        "lines": 4
                    },
                    {
                        "name": "-certsout",
                        "lines": 2
                    },
                    {
                        "name": "-to -from -subject",
                        "lines": 4
                    },
                    {
                        "name": "Printing options",
                        "lines": 1
                    },
                    {
                        "name": "-noout",
                        "lines": 3
                    },
                    {
                        "name": "-print",
                        "lines": 3
                    },
                    {
                        "name": "-nameopt",
                        "lines": 4
                    },
                    {
                        "name": "-receipt",
                        "lines": 2
                    },
                    {
                        "name": "Validation options",
                        "lines": 1
                    },
                    {
                        "name": "-allow -attime -no -check -crl -crl",
                        "lines": 1
                    },
                    {
                        "name": "-explicit -extended -ignore -inhibit -inhibit",
                        "lines": 1
                    },
                    {
                        "name": "-no -partial -policy -policy -policy -purpose -suiteB",
                        "lines": 1
                    },
                    {
                        "name": "-suiteB -suiteB -trusted -use -auth -verify",
                        "lines": 1
                    },
                    {
                        "name": "-verify -verify -verify -verify -x509 -issuer",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 38,
                "subsections": [
                    {
                        "name": "CADES BASIC ELECTRONIC SIGNATURE (CADES-BES)",
                        "lines": 22
                    }
                ]
            },
            {
                "name": "EXIT CODES",
                "lines": 13,
                "subsections": [
                    {
                        "name": "COMPATIBILITY WITH PKCS#7 FORMAT",
                        "lines": 20
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 93,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 9,
                "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] [-verifyreceipt receipt]\n[-digestcreate] [-digestverify] [-compress] [-uncompress] [-EncryptedDataencrypt]\n[-EncryptedDatadecrypt] [-datacreate] [-dataout] [-cmsout]\n\nFile format options:\n\n[-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform DER|PEM|SMIME] [-stream] [-indef]\n[-noindef] [-binary] [-crlfeol] [-asciicrlf]\n\nKeys and password options:\n\n[-pwripassword password] [-secretkey key] [-secretkeyid id] [-inkey filename|uri] [-passin\narg] [-keyopt name:parameter] [-keyform DER|PEM|P12|ENGINE] [-engine id] [-provider name]\n[-provider-path path] [-propquery propq] [-rand files] [-writerand file]\n\nEncryption options:\n\n[-originator file] [-recip file] [recipient-cert ...]  [-cciipphheerr] [-wrap cipher]\n[-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap] [-debugdecrypt]\n\nSigning options:\n\n[-md digest] [-signer file] [-certfile file] [-cades] [-nodetach] [-nocerts] [-noattr]\n[-nosmimecap] [-receiptrequestall] [-receiptrequestfirst] [-receiptrequestfrom\nemailaddress] [-receiptrequestto emailaddress]\n\nVerification options:\n\n[-signer file] [-content filename] [-nocontentverify] [-noattrverify] [-nosigs]\n[-noverify] [-nointern] [-cades] [-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] [-from addr] [-subject\nsubj]\n\nPrinting options:\n\n[-noout] [-print] [-nameopt option] [-receiptrequestprint]\n\nValidation options:\n\n[-allowproxycerts] [-attime timestamp] [-nochecktime] [-checksssig] [-crlcheck]\n[-crlcheckall] [-explicitpolicy] [-extendedcrl] [-ignorecritical] [-inhibitany]\n[-inhibitmap] [-partialchain] [-policy arg] [-policycheck] [-policyprint] [-purpose\npurpose] [-suiteB128] [-suiteB128only] [-suiteB192] [-trustedfirst] [-noaltchains]\n[-usedeltas] [-authlevel num] [-verifydepth num] [-verifyemail email] [-verifyhostname\nhostname] [-verifyip ip] [-verifyname name] [-x509strict] [-issuerchecks]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This command handles data in CMS format such as S/MIME v3.1 email messages.  It can encrypt,\ndecrypt, sign, verify, compress, uncompress, and print messages.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "There are a number of operation options that set the type of operation to be performed:\nencrypt, decrypt, sign, verify, resign, signreceipt, verifyreceipt, digestcreate,\ndigestverify, compress, uncompress, EncryptedDataencrypt, EncryptedDatadecrypt,\ndatacreate, dataout, or cmsout.  The relevance of the other options depends on the\noperation type and their meaning may vary according to it.\n",
                "subsections": [
                    {
                        "name": "-help",
                        "content": "Print out a usage message.\n"
                    },
                    {
                        "name": "General options",
                        "content": ""
                    },
                    {
                        "name": "-in",
                        "content": "The input message to be encrypted or signed or the message to be decrypted or verified.\n"
                    },
                    {
                        "name": "-out",
                        "content": "The message text that has been decrypted or verified or the output MIME format message\nthat has been signed or verified.\n"
                    },
                    {
                        "name": "-config",
                        "content": "See \"Configuration Option\" in openssl(1).\n"
                    },
                    {
                        "name": "Operation options",
                        "content": ""
                    },
                    {
                        "name": "-encrypt",
                        "content": "Encrypt data for the given recipient certificates. Input file is the message to be\nencrypted. The output file is the encrypted data in MIME format. The actual CMS type is\nEnvelopedData.\n\nNote that no revocation check is done for the recipient cert, so if that key has been\ncompromised, others may be able to decrypt the text.\n"
                    },
                    {
                        "name": "-decrypt",
                        "content": "Decrypt data using the supplied certificate and private key. Expects encrypted datain\nMIME format for the input file. The decrypted data is written to the output file.\n"
                    },
                    {
                        "name": "-sign",
                        "content": "Sign data using the supplied certificate and private key. Input file is the message to be\nsigned. The signed data in MIME format is written to the output file.\n"
                    },
                    {
                        "name": "-verify",
                        "content": "Verify signed data. Expects a signed data on input and outputs the signed data. Both\nclear text and opaque signing is supported.\n"
                    },
                    {
                        "name": "-resign",
                        "content": "Resign a message: take an existing message and one or more new signers.\n"
                    },
                    {
                        "name": "-sign",
                        "content": "Generate and output a signed receipt for the supplied message. The input message must\ncontain a signed receipt request. Functionality is otherwise similar to the -sign\noperation.\n"
                    },
                    {
                        "name": "-verify",
                        "content": "Verify a signed receipt in filename receipt. The input message must contain the original\nreceipt request. Functionality is otherwise similar to the -verify operation.\n"
                    },
                    {
                        "name": "-digest",
                        "content": "Create a CMS DigestedData type.\n"
                    },
                    {
                        "name": "-digest",
                        "content": "Verify a CMS DigestedData type and output the content.\n"
                    },
                    {
                        "name": "-compress",
                        "content": "Create a CMS CompressedData type. OpenSSL must be compiled with zlib support for this\noption to work, otherwise it will output an error.\n"
                    },
                    {
                        "name": "-uncompress",
                        "content": "Uncompress a CMS CompressedData type and output the content. OpenSSL must be compiled\nwith zlib support for this option to work, otherwise it will output an error.\n"
                    },
                    {
                        "name": "-EncryptedData",
                        "content": "Encrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type\nand output the content.\n"
                    },
                    {
                        "name": "-EncryptedData",
                        "content": "Decrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type\nand output the content.\n"
                    },
                    {
                        "name": "-data",
                        "content": "Create a CMS Data type.\n"
                    },
                    {
                        "name": "-data",
                        "content": "Data type and output the content.\n"
                    },
                    {
                        "name": "-cmsout",
                        "content": "Takes an input message and writes out a PEM encoded CMS structure.\n"
                    },
                    {
                        "name": "File format options",
                        "content": ""
                    },
                    {
                        "name": "-inform",
                        "content": "The input format of the CMS structure (if one is being read); the default is SMIME.  See\nopenssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-outform",
                        "content": "The output format of the CMS structure (if one is being written); the default is SMIME.\nSee openssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-rctform",
                        "content": "The signed receipt format for use with the -receiptverify; the default is SMIME.  See\nopenssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-stream -indef",
                        "content": "The -stream and -indef options are equivalent and enable streaming I/O for encoding\noperations. This permits single pass processing of data without the need to hold the\nentire contents in memory, potentially supporting very large files. Streaming is\nautomatically set for S/MIME signing with detached data if the output format is SMIME it\nis currently off by default for all other operations.\n"
                    },
                    {
                        "name": "-noindef",
                        "content": "Disable streaming I/O where it would produce and indefinite length constructed encoding.\nThis option currently has no effect. In future streaming will be enabled by default on\nall relevant operations and this option will disable it.\n"
                    },
                    {
                        "name": "-binary",
                        "content": "Normally the input message is converted to \"canonical\" format which is effectively using\nCR and LF as end of line: as required by the S/MIME specification. When this option is\npresent no translation occurs. 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 option is present\nCRLF is used instead.\n"
                    },
                    {
                        "name": "-asciicrlf",
                        "content": "When signing use ASCII CRLF format canonicalisation. This strips trailing whitespace from\nall lines, deletes trailing blank lines at EOF and sets the encapsulated content type.\nThis option is normally used with detached content and an output signature format of DER.\nThis option is not normally needed when verifying as it is enabled automatically if the\nencapsulated content format is detected.\n"
                    },
                    {
                        "name": "Keys and password options",
                        "content": ""
                    },
                    {
                        "name": "-pwri",
                        "content": "Specify password for recipient.\n"
                    },
                    {
                        "name": "-secretkey",
                        "content": "Specify symmetric key to use. The key must be supplied in hex format and be consistent\nwith the algorithm used. Supported by the -EncryptedDataencrypt -EncryptedDatadecrypt,\n-encrypt and -decrypt options. When used with -encrypt or -decrypt the supplied key is\nused to wrap or unwrap the content encryption key using an AES key in the\nKEKRecipientInfo type.\n"
                    },
                    {
                        "name": "-secretkeyid",
                        "content": "The key identifier for the supplied symmetric key for KEKRecipientInfo type.  This option\nmust be present if the -secretkey option is used with -encrypt. With -decrypt operations\nthe id is used to locate the relevant key if it is not supplied then an attempt is used\nto decrypt any KEKRecipientInfo structures.\n"
                    },
                    {
                        "name": "-inkey",
                        "content": "The private key to use when signing or decrypting. This must match the corresponding\ncertificate. If this option is not specified then the private key must be included in the\ncertificate file specified with the -recip or -signer file. When signing this option can\nbe used multiple times to specify successive keys.\n"
                    },
                    {
                        "name": "-passin",
                        "content": "The private key password source. For more information about the format of arg see\nopenssl-passphrase-options(1).\n"
                    },
                    {
                        "name": "-keyopt",
                        "content": "For signing and encryption this option can be used multiple times to set customised\nparameters for the preceding key or certificate. It can currently be used to set RSA-PSS\nfor signing, RSA-OAEP for encryption or to modify default parameters for ECDH.\n"
                    },
                    {
                        "name": "-keyform",
                        "content": "The format of the private key file; unspecified by default.  See\nopenssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-engine",
                        "content": "See \"Engine Options\" in openssl(1).  This option is deprecated.\n"
                    },
                    {
                        "name": "-provider",
                        "content": ""
                    },
                    {
                        "name": "-provider-path",
                        "content": ""
                    },
                    {
                        "name": "-propquery",
                        "content": "See \"Provider Options\" in openssl(1), provider(7), and property(7).\n"
                    },
                    {
                        "name": "-rand -writerand",
                        "content": "See \"Random State Options\" in openssl(1) for details.\n"
                    },
                    {
                        "name": "Encryption and decryption options",
                        "content": ""
                    },
                    {
                        "name": "-originator",
                        "content": "A certificate of the originator of the encrypted message. Necessary for decryption when\nKey Agreement is in use for a shared key.\n"
                    },
                    {
                        "name": "-recip",
                        "content": "When decrypting a message this specifies the certificate of the recipient.  The\ncertificate must match one of the recipients of the message.\n\nWhen encrypting a message this option may be used multiple times to specify each\nrecipient. This form must be used if customised parameters are required (for example to\nspecify RSA-OAEP).\n\nOnly certificates carrying RSA, Diffie-Hellman or EC keys are supported by this option.\n\nrecipient-cert ...\nThis is an alternative to using the -recip option when encrypting a message.  One or more\ncertificate filennames may be given.\n\n-cciipphheerr\nThe encryption algorithm to use. For example triple DES (168 bits) - -des3 or 256 bit AES\n- -aes256. Any standard algorithm name (as used by the EVPgetcipherbyname() function)\ncan also be used preceded by a dash, for example -aes-128-cbc. See openssl-enc(1) for a\nlist of ciphers supported by your version of OpenSSL.\n\nCurrently the AES variants with GCM mode are the only supported AEAD algorithms.\n\nIf not specified triple DES is used. Only used with -encrypt and -EncryptedDatacreate\ncommands.\n"
                    },
                    {
                        "name": "-wrap",
                        "content": "Cipher algorithm to use for key wrap when encrypting the message using Key Agreement for\nkey transport. The algorithm specified should 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.  Depending on the\nOpenSSL build options used, -des3-wrap may not be supported.\n"
                    },
                    {
                        "name": "-debug",
                        "content": "This option sets the CMSDEBUGDECRYPT flag. This option should be used with caution: see\nthe notes section below.\n"
                    },
                    {
                        "name": "Signing options",
                        "content": ""
                    },
                    {
                        "name": "-md",
                        "content": "Digest algorithm to use when signing or resigning. If not present then the default digest\nalgorithm for the signing key will be used (usually SHA1).\n"
                    },
                    {
                        "name": "-signer",
                        "content": "A signing certificate.  When signing or resigning a message, this option can be used\nmultiple times if more than one signer is required.\n"
                    },
                    {
                        "name": "-certfile",
                        "content": "Allows additional certificates to be specified. When signing these will be included with\nthe message. When verifying these will be searched for the signers certificates.  The\ninput can be in PEM, DER, or PKCS#12 format.\n"
                    },
                    {
                        "name": "-cades",
                        "content": "When used with -sign, add an ESS signingCertificate or ESS signingCertificateV2 signed-\nattribute to the SignerInfo, in order to make the signature comply with the requirements\nfor a CAdES Basic Electronic Signature (CAdES-BES).\n"
                    },
                    {
                        "name": "-nodetach",
                        "content": "When signing a message use opaque signing: this form is more resistant to translation by\nmail relays but it cannot be read by mail agents that do not support S/MIME.  Without\nthis option cleartext signing with the MIME type multipart/signed is used.\n"
                    },
                    {
                        "name": "-nocerts",
                        "content": "When signing a message the signer's certificate is normally included with this option it\nis excluded. This will reduce the size of the signed message but the verifier must have a\ncopy of the signers certificate available locally (passed using the -certfile option for\nexample).\n"
                    },
                    {
                        "name": "-noattr",
                        "content": "Normally when a message is signed a set of attributes are included which include the\nsigning time and supported symmetric algorithms. With this option they are not included.\n"
                    },
                    {
                        "name": "-nosmimecap",
                        "content": "Exclude the list of supported algorithms from signed attributes, other options such as\nsigning time and content type are still included.\n"
                    },
                    {
                        "name": "-receipt -receipt",
                        "content": "For -sign option include a signed receipt request. Indicate requests should be provided\nby all recipient or first tier recipients (those mailed directly and not from a mailing\nlist). Ignored it -receiptrequestfrom is included.\n"
                    },
                    {
                        "name": "-receipt",
                        "content": "For -sign option include a signed receipt request. Add an explicit email address where\nreceipts should be supplied.\n"
                    },
                    {
                        "name": "-receipt",
                        "content": "Add an explicit email address where signed receipts should be sent to. This option must\nbut supplied if a signed receipt is requested.\n"
                    },
                    {
                        "name": "Verification options",
                        "content": ""
                    },
                    {
                        "name": "-signer",
                        "content": "If a message has been verified successfully then the signers certificate(s) will be\nwritten to this file if the verification was successful.\n"
                    },
                    {
                        "name": "-content",
                        "content": "This specifies a file containing the detached content for operations taking S/MIME input,\nsuch as the -verify command. This is only usable if the CMS structure is using the\ndetached signature form where the content is not included. This option will override any\ncontent if the input format is S/MIME and it uses the multipart/signed MIME content type.\n"
                    },
                    {
                        "name": "-no",
                        "content": "Do not verify signed content signatures.\n"
                    },
                    {
                        "name": "-no",
                        "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 the message are\nsearched for the signing certificate. With this option only the certificates specified in\nthe -certfile option are used.  The supplied certificates can still be used as untrusted\nCAs however.\n"
                    },
                    {
                        "name": "-cades",
                        "content": "When used with -verify, require and check signer certificate digest.  See the NOTES\nsection for more details.\n"
                    },
                    {
                        "name": "-verify",
                        "content": "Exit nonzero on verification failure.\n"
                    },
                    {
                        "name": "-CAfile -no-CAfile -CApath -no-CApath -CAstore -no-CAstore",
                        "content": "See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.\n"
                    },
                    {
                        "name": "Output options",
                        "content": ""
                    },
                    {
                        "name": "-keyid",
                        "content": "Use subject key identifier to identify certificates instead of issuer name and serial\nnumber. The supplied certificate must include a subject key identifier extension.\nSupported by -sign and -encrypt options.\n"
                    },
                    {
                        "name": "-econtent",
                        "content": "Set the encapsulated content type to type if not supplied the Data type is used. The type\nargument can be any valid OID name in either text or numerical format.\n"
                    },
                    {
                        "name": "-text",
                        "content": "This option adds plain text (text/plain) MIME headers to the supplied message if\nencrypting or signing. If decrypting or verifying it strips off text headers: if the\ndecrypted or verified message is not of MIME type text/plain then an error occurs.\n"
                    },
                    {
                        "name": "-certsout",
                        "content": "Any certificates contained in the input message are written to file.\n"
                    },
                    {
                        "name": "-to -from -subject",
                        "content": "The relevant email headers. These are included outside the signed portion of a message so\nthey may be included manually. If signing then many S/MIME mail clients check the signers\ncertificate's email address matches that specified in the From: address.\n"
                    },
                    {
                        "name": "Printing options",
                        "content": ""
                    },
                    {
                        "name": "-noout",
                        "content": "For the -cmsout operation do not output the parsed CMS structure.  This is useful if the\nsyntax of the CMS structure is being checked.\n"
                    },
                    {
                        "name": "-print",
                        "content": "For the -cmsout operation print out all fields of the CMS structure.  This implies\n-noout.  This is mainly useful for testing purposes.\n"
                    },
                    {
                        "name": "-nameopt",
                        "content": "For the -cmsout operation when -print option is in use, specifies printing options for\nstring fields. For most cases utf8 is reasonable value.  See\nopenssl-namedisplay-options(1) for details.\n"
                    },
                    {
                        "name": "-receipt",
                        "content": "For the -verify operation print out the contents of any signed receipt requests.\n"
                    },
                    {
                        "name": "Validation options",
                        "content": ""
                    },
                    {
                        "name": "-allow -attime -no -check -crl -crl",
                        "content": ""
                    },
                    {
                        "name": "-explicit -extended -ignore -inhibit -inhibit",
                        "content": ""
                    },
                    {
                        "name": "-no -partial -policy -policy -policy -purpose -suiteB",
                        "content": ""
                    },
                    {
                        "name": "-suiteB -suiteB -trusted -use -auth -verify",
                        "content": ""
                    },
                    {
                        "name": "-verify -verify -verify -verify -x509 -issuer",
                        "content": "Set various options of certificate chain verification.  See \"Verification Options\" in\nopenssl-verification-options(1) for details.\n\nAny validation errors cause the command to exit.\n"
                    }
                ]
            },
            "NOTES": {
                "content": "The MIME message must be sent without any blank lines between the headers and the output.\nSome mail programs will automatically add a blank line. Piping the mail directly to sendmail\nis one way to achieve the correct format.\n\nThe supplied message to be signed or encrypted must include the necessary MIME headers or\nmany S/MIME clients won't display it properly (if at all). You can use the -text option to\nautomatically add plain text headers.\n\nA \"signed and encrypted\" message is one where a signed message is then encrypted. This can be\nproduced by encrypting an already signed message: see the examples section.\n\nThis version of the program only allows one signer per message but it will verify multiple\nsigners on received messages. Some S/MIME clients choke if a message contains multiple\nsigners. It is possible to sign messages \"in parallel\" by signing an already signed message.\n\nThe options -encrypt and -decrypt reflect common usage in S/MIME clients. Strictly speaking\nthese process CMS enveloped data: CMS encrypted data is used for other purposes.\n\nThe -resign option uses an existing message digest when adding a new signer. This means that\nattributes must be present in at least one existing signer using the same message digest or\nthis operation will fail.\n\nThe -stream and -indef options enable streaming I/O support.  As a result the encoding is BER\nusing indefinite length constructed encoding and no longer DER. Streaming is supported for\nthe -encrypt operation and the -sign operation if the content is not detached.\n\nStreaming is always used for the -sign operation with detached data but since the content is\nno longer part of the CMS structure the encoding remains DER.\n\nIf the -decrypt option is used without a recipient certificate then an attempt is made to\nlocate the recipient by trying each potential recipient in turn using the supplied private\nkey. To thwart the MMA attack (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all\nrecipients are tried whether they succeed or not and if no recipients match the message is\n\"decrypted\" using a random key which will typically output garbage.  The -debugdecrypt\noption can be used to disable the MMA attack protection and return an error if no recipient\ncan be found: this option should be used with caution. For a fuller description see\nCMSdecrypt(3)).\n",
                "subsections": [
                    {
                        "name": "CADES BASIC ELECTRONIC SIGNATURE (CADES-BES)",
                        "content": "A CAdES Basic Electronic Signature (CAdES-BES), as defined in the European Standard ETSI EN\n319 122-1 V1.1.1, contains:\n\n•   The signed user data as defined in CMS (RFC 3852);\n\n•   Content-type of the EncapsulatedContentInfo value being signed;\n\n•   Message-digest of the eContent OCTET STRING within encapContentInfo being signed;\n\n•   An ESS signingCertificate or ESS signingCertificateV2 attribute, as defined in Enhanced\nSecurity Services (ESS), RFC 2634 and RFC 5035.  An ESS signingCertificate attribute only\nallows for SHA-1 as digest algorithm.  An ESS signingCertificateV2 attribute allows for\nany digest algorithm.\n\n•   The digital signature value computed on the user data and, when present, on the signed\nattributes.\n\nNOTE that the -cades option applies to the -sign or -verify operations.  With this\noption, the -verify operation also requires that the signingCertificate attribute is\npresent and checks that the given identifiers match the verification trust chain built\nduring the verification process.\n"
                    }
                ]
            },
            "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 message.\n\n4   An error occurred decrypting or verifying the message.\n\n5   The message was verified correctly but an error occurred writing out the signers\ncertificates.\n",
                "subsections": [
                    {
                        "name": "COMPATIBILITY WITH PKCS#7 FORMAT",
                        "content": "openssl-smime(1) can only process the older PKCS#7 format.  openssl cms supports\nCryptographic Message Syntax format.  Use of some features will result in messages which\ncannot be processed by applications which only support the older format. These are detailed\nbelow.\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 processed by the older\nopenssl-smime(1) command.\n"
                    }
                ]
            },
            "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 the private key from\nanother 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 headers:\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 the message being\nencrypted 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 detached signature\nformat. You can use this program to verify the signature by line wrapping the base64 encoded\nstructure and surrounding it 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 that I've thrown at it\nbut it may choke on others.\n\nThe code currently will only write out the signer's certificate to a file: if the signer has\na separate encryption certificate this must be manually extracted. There should be some\nheuristic that determines the correct encryption certificate.\n\nIdeally a database should be maintained of a certificates for each email address.\n\nThe code doesn't currently take note of the permitted symmetric encryption algorithms as\nsupplied in the SMIMECapabilities signed attribute. this means the user has to manually\ninclude the correct encryption algorithm. It should store the list of permitted ciphers in a\ndatabase 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 added in OpenSSL\n1.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 1.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 this file except in\ncompliance with the License.  You can obtain a copy in the file LICENSE in the source\ndistribution or at <https://www.openssl.org/source/license.html>.\n\n\n\n3.0.2                                        2026-06-02                            OPENSSL-CMS(1SSL)",
                "subsections": []
            }
        }
    }
}