smime
The smime
command is used to encrypt, decrypt, sign, and verify S/MIME format
messages. It supports versions of S/MIME up to v2 and can be used to
S/MIME-enable mail readers that do not natively support it.
Specify the name of a file from which data will be read. If this
option is omitted, stdin will be used by default.
Specify the format of the input data. If this option is omitted, the
default is to use SMIME. This option is ignored if
data is being encrypted or signed.
Specify the name of a file to which data will be written. If this
option is omitted, stdout will be used by default.
Specify the format of the output data. If this option is omitted, the
default is to use SMIME. This option is ignored if
data is being decrypted or verified.
Cause the input data to be encrypted.
Cause the input data to be decrypted.
Cause the input data to be signed.
Cause the input data to be verified.
Cause the input data to be written out as a PEM-encoded PKCS#7 structure.
Specify the name of a file containing the detached content. This option is valid only when verifying data.
Cause plaintext MIME headers to be added to the output if the input data is being encrypted or signed. Cause plaintext MIME headers to be stripped from the input if the input data is being decrypted or verified.
Specify the name of a file containing trusted certificates for use in verifying.
Specify the name of a directory containing trusted certificates for use in verifying. Each file in the directory should contain a single certificate and be named with the certificate issuer name’s hash and an extension of “.0”.
When verifying data, cause any certificates included in the data to be considered untrusted.
Do not verify the signer’s certificate of a signed message.
Do not perform chain verification of the signer’s certificate or certificates.
Do not attempt to verify the signatures on the input data.
Do not include certificates in the signed data when signing.
Do not include attributes like the time the data was signed in the output when signing.
Do not perform canonical translation.
Use opaque signing when signing data. Using this option requires that any mail agents encountering this message must be S/MIME-enabled. If this option is not specified, cleartext signing with the MIME type multipart/signed is used.
Specify the name of a file containing one or more certificates. When signing, these certificates will be included in the signed data. When verifying, these certificates will be searched for the signer’s certificate.
Specify the name of a file that the signer’s certificate will be written to when verifying a signature. When signing, this file should contain the signer’s certificate.
Specify the name of a file that contains the recipient’s certificate. The certificate must match one of the recipients of the data.
Specify the name of a file containing the private key to use when
signing or decrypting data. The private key must match the public key
contained in the certificate. If this option is omitted, the private
key must be included in the certificate file specified with the
recip or signer options.
Specify the password or passphrase required to decrypt the private key when signing or decrypting data. This option follows the guidelines outlined in Chapter 2 for passwords and passphrases.
Specify the name of a file or files that will be used to seed the PRNG. This option follows the guidelines outlined in Chapter 2.
Specify the address of the recipient. If this is specified, it is included as part of the headers written outside the encrypted or signed data.
Specify the address of the sender. If this is specified, it is included as part of the headers written outside the encrypted or signed data.
Specify the subject of the message. If this is specified, it is included as part of the headers written outside the encrypted or signed data.
When encrypting a message, files containing the certificates of the recipients in PEM format are also required on the command line. The filenames should be included after all other options are specified in free form.
When sending S/MIME messages using this command, it is important that no blank line be inserted between the message’s headers and the output from this command. Some mail programs add a blank space, so care must be taken to avoid that.
This command allows only a single signer per message when signing. When verifying a signed message, the command does support multiple signers. Some S/MIME clients do not deal well with messages that have multiple signers. It is possible to sign an already signed message to achieve a similar effect.
The command sets the exit code (or errorlevel on Windows) according to the status of the command’s requested operation. Exit codes are as follows:
The operation was completed successfully.
An error occurred when parsing the command’s options.
One of the input files could not be read.
An error occurred creating the PKCS#7 file or when reading the MIME message.
An error occurred decrypting or verifying the message.
The message was verified correctly, but an error occurred when attempting to write out the signer’s certificate or certificates.