Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
NAME
CMS_sign — create a CMS SignedData structureSYNOPSIS
#include <openssl/cms.h>CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, unsigned int flags);
DESCRIPTION
CMS_sign() creates and returns a CMS SignedData structure. signcert is the certificate to sign with, pkey is the corresponding private key. certs is an optional additional set of certificates to include in the CMS structure (for example any intermediate CAs in the chain). Any or all of these parameters can be NULL.- CMS_TEXT
- Prepend MIME headers for the type text/plain to the data. Many S/MIME clients expect the signed content to include valid MIME headers.
- CMS_NOCERTS
- Do not include the signer's certificate in the CMS_ContentInfo structure. The signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signature if the signer's certificate can be obtained by other means, for example from a previously signed message.
- CMS_DETACHED
- Omit the data being signed from the CMS_ContentInfo structure. This is used for CMS_ContentInfo detached signatures which are used in S/MIME plaintext signed messages for example.
- CMS_BINARY
- Do not translate the supplied content into MIME canonical format even though that is required by the S/MIME specifications. This option should be used if the supplied data is in binary format. Otherwise the translation will corrupt it.
- CMS_NOATTR
- Do not add any SignedAttributes. By default, the signerInfos field includes several CMS SignedAttributes including the signing time, the CMS content type, and the supported list of ciphers in an SMIMECapabilities attribute.
- CMS_NOSMIMECAP
- Omit just the SMIMECapabilities. If present, the SMIMECapabilities attribute indicates support for the following algorithms in preference order: 256-bit AES, 192-bit AES, 128-bit AES, triple DES, 128-bit RC2, 64-bit RC2, DES and 40-bit RC2. If any of these algorithms is not available, then it will not be included.
- CMS_USE_KEYID
- Use the subject key identifier value to identify signing certificates. An error occurs if the signing certificate does not have a subject key identifier extension. By default, issuer name and serial number are used instead.
- CMS_STREAM
- Only initialize the returned CMS_ContentInfo structure to prepare it for performing the signing operation. The signing is however not performed and the data to be signed is not read from the data parameter. Signing is deferred until after the data has been written. In this way, data can be signed in a single pass. The returned CMS_ContentInfo structure is not complete and outputting its contents via a function that does not properly finalize the CMS_ContentInfo structure will give unpredictable results. Several functions including SMIME_write_CMS(3), i2d_CMS_bio_stream(3), or PEM_write_bio_CMS_stream(3) finalize the structure. Alternatively, finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_CMS(3).
- CMS_PARTIAL
- Output a partial CMS_ContentInfo structure to which additional signers and capabilities can be added before finalization.
RETURN VALUES
CMS_sign() returns either a valid CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).SEE ALSO
CMS_add0_cert(3), CMS_add1_signer(3), CMS_ContentInfo_new(3), CMS_final(3), CMS_sign_receipt(3), CMS_verify(3)STANDARDS
RFC 5652: Cryptographic Message Syntax (CMS)- section 5.1: SignedData Type
- section 5.3: SignerInfo Type