CMS_GET0_SIGNERINFOS(3ossl)
π CMS_GET0_SIGNERINFOS π
ok so this is the 3ossl girlies' guide to the CMS signedData signer functions β CMS_SignerInfo_set1_signer_cert, CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_get0_signature, and CMS_SignerInfo_cert_cmp. yes that's a lot of names, no we're not scared, let's go π«Ά
β¨ 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);
like, just look at it. iconic. π
π¦ DESCRIPTION π¦
So CMS_get0_SignerInfos() hands you all the CMS_SignerInfo structures that are hanging out with a CMS signedData structure. the whole friend group. π
CMS_SignerInfo_get0_signer_id() is the one that goes "ok who signed this" β it retrieves the certificate signer identifier for a specific CMS_SignerInfo structure si. And it's either/or, bestie: either the keyidentifier gets set in keyid, or both the issuer name and serial number get set in issuer and sno.
CMS_SignerInfo_get0_signature() grabs the signature linked to si, handed to you as a pointer to an ASN1_OCTET_STRING structure. and here's the slay part: that returned pointer is the internal signature value if si, so you can literally read it or modify it. main character pointer energy. β¨
CMS_SignerInfo_cert_cmp() compares the certificate cert against the signer identifier si. returns zero if the comparison is successful and non zero if not. simple as. π
CMS_SignerInfo_set1_signer_cert() sets the signers certificate of si to signer. boom, done.
πΈ NOTES πΈ
The whole point of these functions, like, the reason they exist: they let an application lookup signers certificates using any appropriate technique when the simpler method of CMS_verify() is not appropriate. sometimes the simple way just isn't the vibe. π
In typical usage an application will retrieve all CMS_SignerInfo structures using CMS_get0_SignerInfo() and retrieve the identifier information using CMS. then it obtains the signer certificate by some unspecified means (or returns an error if it cannot be found) and sets it using CMS_SignerInfo_set1_signer_cert(). iykyk. π§
Once all signer certificates have been set, CMS_verify() can be used. periodt. β
ok so yes βCMS_get0_SignerInfos()can returnNULLif an error occurs or if there are no signers. but ngl this is not a problem in practice, because the only error which can occur is if thecmsstructure is not of type signedData due to application error. so likeβ¦ that's a you problem, 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 giving void, it's giving no thoughts head empty π
Any error can be obtained from ERR_get_error(3). go get that lore.
π SEE ALSO π
ERR_get_error(3), CMS_verify(3)
π COPYRIGHT π
Copyright 2008-2018 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 babes, certified slay, 3.5.0 and dated 2026-09-25 β go forth and verify those signers ππ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms