CMS_ADD1_SIGNER(3ossl)
π CMS_ADD1_SIGNER(3ossl) π
okay so bestie, welcome to the CMS_add1_signer(3ossl) page β it's part of the OpenSSL manual, and it's literally all about adding a signer to a CMS_ContentInfo signed data structure. the way this function is so main character fr fr π«Ά
β¨ 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 like, CMS_add1_signer() is the vibe where you add a signer β that's your certificate signcert and your private key pkey, using message digest md β to a CMS_ContentInfo SignedData structure called cms. iconic behavior tbh π
the CMS_ContentInfo structure should come from an initial call to CMS_sign() with the flag CMS_PARTIAL set, OR from re-signing a valid CMS_ContentInfo SignedData structure. iykyk.
if the md parameter is NULL then the default digest for the public key algorithm gets used instead. no stress, it's handled π
and 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 leave it hanging bestie π
CMS_SignerInfo_sign() is the function that explicitly signs a CMS_SignerInfo structure. its main use? when both the CMS_REUSE_DIGEST and CMS_PARTIAL flags are set. that's the moment it shines β¨
π NOTES π
the main purpose of CMS_add1_signer() is to give you finer control over a CMS signed data structure β like, for when the simpler CMS_sign() function defaults just aren't giving what you need. for example: multiple signers, or non-default digest algorithms. new attributes can also be added using the returned CMS_SignerInfo structure, plus the CMS attribute utility functions or the CMS signed receipt request functions. so many options, so much power π
any of the following flags (ored together) can be passed in the flags parameter:
CMS_REUSE_DIGESTβ when set, an attempt is made to copy the content digest value from the CMS_ContentInfo structure, so you can add a signer to an existing structure. an error occurs if a matching digest value can't be found to copy. when this flag is set, the returned CMS_ContentInfo structure will be valid and finalized. periodt πCMS_PARTIALβ if this is set in addition toCMS_REUSE_DIGEST, then the CMS_SignerInfo structure will not be finalized, so you can add additional attributes. in that case you need an explicit call toCMS_SignerInfo_sign()to finalize it. no skipping that step πCMS_NOCERTSβ if set, the signer's certificate will not be included in the CMS_ContentInfo structure. but 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, including 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. none. zero. πCMS_NOSMIMECAPβ if set, the SMIMECapabilities will be omitted. bye felicia πCMS_NO_SIGNING_TIMEβ if set, the signing time will be omitted. timestamps? not today πCMS_USE_KEYIDβ OpenSSL by default identifies signing certificates using issuer name and serial number. if this flag is set, it uses the subject key identifier value instead. β οΈ an error occurs if the signing certificate does not have a subject key identifier extension. so make sure it has one, bestie!!
if present, the SMIMECapabilities attribute 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. and if any of these algorithms isn't available, then it won't be included β for example the GOST algorithms won't be included if the GOST ENGINE is not loaded. it's giving "only the available ones make the cut" π
CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo structure it just added β and you can use that to set additional attributes before it's finalized. so handy π«Ά
π₯ RETURN VALUES π₯
CMS_add1_signer()returns an internal pointer to the CMS_SignerInfo structure 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),
Β©οΈ 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>.
and that's the whole page bestie!! this one's from OpenSSL 3.5.9, dated 2026-09-29, and it lives in the CMS_ADD1_SIGNER(3ossl) manual. slay, go sign something π
β¨π¦
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms