CMS_ADD1_SIGNER(3ossl)
π CMS_add1_signer, CMS_SignerInfo_sign β adding a signer, the iconic way
okay so real talk, bestie: this is the 3ossl manual page for CMS_add1_signer and CMS_SignerInfo_sign, and it's literally all about adding a signer to a CMS_ContentInfo signed data structure. stay with me, it's gonna be so good π
β¨ NAME β¨
CMS_add1_signer, CMS_SignerInfo_sign β add a signer to a CMS_ContentInfo signed data structure. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <openssl/cms.h>
CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, X509 *signcert,
EVP_PKEY *pkey, const EVP_MD *md,
unsigned int flags);
int CMS_SignerInfo_sign(CMS_SignerInfo *si);
π¦ DESCRIPTION π¦
so CMS_add1_signer() adds a signer to the CMS_ContentInfo SignedData structure cms, using certificate signcert and private key pkey, with message digest md. slay.
the CMS_ContentInfo structure should be the one you got from an initial call to CMS_sign() with the CMS_PARTIAL flag set β OR, in the case of re-signing, a valid CMS_ContentInfo SignedData structure. either way, it's giving "valid source material only". β¨
if the md parameter is NULL, then the default digest for the public key algorithm is used. no cap, that's just what happens.
unless the CMS_REUSE_DIGEST flag is set, the returned CMS_ContentInfo structure is not complete and must be finalized β either by streaming (if that applies to you) or by a call to CMS_final(). don't forget, bestie, it's like unfinished homework π
and CMS_SignerInfo_sign() explicitly signs a CMS_SignerInfo structure. its main use is when the CMS_REUSE_DIGEST and CMS_PARTIAL flags are both set. main character energy fr.
π NOTES π
the main purpose of CMS_add1_signer() is to give you finer control over a CMS signed data structure, for when the simpler CMS_sign() function defaults are just not it. for example: multiple signers, or non-default digest algorithms. new attributes can also be added using the returned CMS_SignerInfo structure β with the CMS attribute utility functions, or the CMS signed receipt request functions. very demure, very customizable. π§
any of the following flags (ored together) can be passed in the flags parameter:
CMS_REUSE_DIGESTβ if set, an attempt is made to copy the content digest value from theCMS_ContentInfostructure, so you can add a signer to an existing structure. an error occurs if a matching digest value cannot be found to copy. when this flag is set, the returnedCMS_ContentInfostructure will be valid and finalized. πCMS_PARTIALβ if set in addition toCMS_REUSE_DIGEST, theCMS_SignerInfostructure will not be finalized, so you can add additional attributes. in this case you need an explicit call toCMS_SignerInfo_sign()to finalize it. π₯CMS_NOCERTSβ if set, the signer's certificate will not be included in theCMS_ContentInfostructure. the signer's certificate must still be supplied in thesigncertparameter though. this can reduce the size of the signature if the signer's certificate can be obtained by other means β for example, a previously signed message. sneaky but valid π«ΆCMS_NOATTRβ the SignedData structure includes several CMS signedAttributes: the signing time, the CMS content type, and the supported list of ciphers in an SMIMECapabilities attribute. ifCMS_NOATTRis set, then no signedAttributes will be used at all. πCMS_NOSMIMECAPβ if set, the SMIMECapabilities will be omitted.CMS_NO_SIGNING_TIMEβ if set, the signing time will be omitted.CMS_USE_KEYIDβ OpenSSL will by default identify signing certificates using issuer name and serial number. ifCMS_USE_KEYIDis set, it will use the subject key identifier value instead. an error occurs if the signing certificate does not have a subject key identifier extension. π
okay and about that SMIMECapabilities attribute β if present, it indicates support for the following algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 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: for example, the GOST algorithms will not be included if the GOST ENGINE is not loaded. iykyk π
and finally: CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo structure just added. use it to set additional attributes before it's finalized. β¨
π RETURN VALUES π
CMS_add1_signer()returns an internal pointer to theCMS_SignerInfostructure just added, orNULLif an error occurs. πCMS_SignerInfo_sign()returns1on success,0on failure.
π SEE ALSO π
ERR_get_error(3), CMS_sign(3), CMS_final(3) β go read those too, bestie, they're all part of the same little friend group π«Ά
π COPYRIGHT π
Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
that's the whole page, no notes. version3.5.6, dated2026-04-07, and it's theCMS_ADD1_SIGNER(3ossl)manual β periodt. π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms