CMS_GET0_SIGNERINFOS(3ssl)
π
CMS_GET0_SIGNERINFOS β the OpenSSL 3ssl manual, bestie edition π
okay so this is the 3ssl manual page for the CMS signedData signer functions, and honestly? it's giving "backstage pass to how signatures actually get checked" β¨
πΈ NAME πΈ
CMS_SignerInfo_set1_signer_cert, CMS_SignerInfo_get0_signer_cert, CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_get0_signature, CMS_SignerInfo_cert_cmp, CMS_SignerInfo_get_verification_result β the CMS signedData signer functions, aka the whole squad π
β¨ SYNOPSIS β¨
#include <openssl/cms.h>
STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid,
X509_NAME **issuer, ASN1_INTEGER **sno);
ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
X509 *CMS_SignerInfo_get0_signer_cert(CMS_SignerInfo *si);
int CMS_SignerInfo_get_verification_result(CMS_SignerInfo *si, int type);
π DESCRIPTION π
So here's the tea on each one π
CMS_get0_SignerInfos()β hands you all theCMS_SignerInfostructures chillin' inside a CMS signedData structure. the whole group chat, no cap.CMS_SignerInfo_get0_signer_id()β digs out the certificate signer identifier for one specificCMS_SignerInfostructure,si. and it's literally one or the other: either the keyidentifier gets set inkeyid, or both the issuer name and serial number get set inissuerandsno. iykyk π¦CMS_SignerInfo_get0_signature()β pulls the signature forsiand gives it to you as a pointer to anASN1_OCTET_STRINGstructure. and the plot twist? that pointer is the internal signature value ofsi, so you can read it or modify it. main character pointer energy tbh πCMS_SignerInfo_cert_cmp()β compares the certificatecertagainst the signer identifiersi. returns zero if the comparison slays (successful), non-zero if not. periodt.CMS_SignerInfo_set1_signer_cert()β sets the signer's certificate ofsitosigner. simple, iconic, done.CMS_SignerInfo_get0_signer_cert()β returns the signer's certificate associated withsi. β οΈ and listen: this pointer should not be freed by the caller. don't do it. not you. πCMS_SignerInfo_get_verification_result()β tells you whether one specific aspect of the signature verification worked, after you've calledCMS_verify(3)with the flagCMS_VERIFY_PARTIAL. thetypeyou pass decides the vibe check:CMS_VERIFY_RESULTβ the overall result π₯CMS_VERIFY_CERTβ certificate verificationCMS_VERIFY_ATTRβ attribute verificationCMS_VERIFY_CONTENTβ content verification
π§ NOTES π§
the whole point of these functions is letting your app look up signer certificates using whatever technique fits, for when the simpler CMS_verify() route isn't the move. π
typical usage goes like this: the application retrieves all the CMS_SignerInfo structures using CMS_get0_SignerInfo(), gets the identifier info using CMS. then it obtains the signer certificate by some unspecified means (or returns an error if it can't find it) and sets it with CMS_SignerInfo_set1_signer_cert(). π
once all the signer certificates are set, CMS_verify() can be used. slay. β¨
and yeah β CMS_get0_SignerInfos() can return NULL if an error occurs or if there are no signers, but in practice that's not a problem, because the only error that can happen is the cms structure not being of type signedData, which is an application error. so like, if that happens, it's on you bestie π
π RETURN VALUES π
CMS_get0_SignerInfos()β returns allCMS_SignerInfostructures, orNULLif there are no signers or an error occurs.CMS_SignerInfo_get0_signer_id()β returns1for success and0for failure.CMS_SignerInfo_cert_cmp()β returns0for a successful comparison and non zero otherwise.CMS_SignerInfo_set1_signer_cert()β does not return a value. it's above returning things, honestly.- any error can be obtained from
ERR_get_error(3).
π¦ SEE ALSO π¦
ERR_get_error(3), CMS_verify(3)
β HISTORY β
CMS_SignerInfo_get0_signer_cert and CMS_SignerInfo_get_verification_result were added in OpenSSL 4.1. new arrivals, and they ate π
π COPYRIGHT π
Copyright 2008-2026 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 page!! brought to you by OpenSSL 4.1.0, dated 2026-10-23 β the CMS_GET0_SIGNERINFOS(3ssl) manual, rewritten with love, glitter, and zero lost details π«ΆππΈ
π¦ where this page comes from
- nixos 26.05: openssl 4.1.0
- nixpkgs unstable: openssl 4.1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms