CMS_SIGNED_ADD1_ATTR(3)
π NAME π
okay bestie, this is the manual page for CMS_SIGNED_ADD1_ATTR(3), and it is literally all about changing signed and unsigned attributes of a CMS SignerInfo object. The whole squad is:
CMS_signed_add1_attr, CMS_signed_add1_attr_by_NID, CMS_signed_add1_attr_by_OBJ, CMS_signed_add1_attr_by_txt, CMS_signed_delete_attr, CMS_signed_get0_data_by_OBJ, CMS_signed_get_attr, CMS_signed_get_attr_by_NID, CMS_signed_get_attr_by_OBJ, CMS_signed_get_attr_count, CMS_unsigned_add1_attr, CMS_unsigned_add1_attr_by_NID, CMS_unsigned_add1_attr_by_OBJ, CMS_unsigned_add1_attr_by_txt, CMS_unsigned_delete_attr, CMS_unsigned_get0_data_by_OBJ, CMS_unsigned_get_attr, CMS_unsigned_get_attr_by_NID, CMS_unsigned_get_attr_by_OBJ, CMS_unsigned_get_attr_count β change signed and unsigned attributes of a CMS SignerInfo object.
β¨ SYNOPSIS β¨
this comes from libcrypto, so you already know it is giving crypto-core π
library βlibcryptoβ #include <openssl/cms.h>
int
CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
int
CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
const void *bytes, int len);
int
CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj,
int type, const void *bytes, int len);
int
CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname,
int type, const void *bytes, int len);
X509_ATTRIBUTE *
CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
void *
CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
int start_after, int type);
X509_ATTRIBUTE *
CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
int
CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
int start_after);
int
CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si,
const ASN1_OBJECT *obj, int start_after);
int
CMS_signed_get_attr_count(const CMS_SignerInfo *si);
int
CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
int
CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
const void *bytes, int len);
int
CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
const ASN1_OBJECT *obj, int type, const void *bytes, int len);
int
CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname,
int type, const void *bytes, int len);
X509_ATTRIBUTE *
CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
void *
CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
int start_after, int type);
X509_ATTRIBUTE *
CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
int
CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
int start_after);
int
CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
const ASN1_OBJECT *obj, int start_after);
int
CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
π¦ DESCRIPTION π¦
okay so picture this: a CMS_SignerInfo object has two optional sets of X.501 attributes β a set of signed attributes in the signedAttrs array and a set of unsigned attributes in the unsignedAttrs array. The CMS_signed_*() and CMS_unsigned_*() functions are similar, except CMS_signed_*() modifies the CMS_SignerInfo object's set of signed attributes and CMS_unsigned_*() modifies the CMS_SignerInfo object's set of unsigned attributes. For brevity only the CMS_signed_*() functions are described below. (The unsigned girlies mirror them, iykyk. π
)
CMS_signed_add1_attr()β appends a deep copy ofattrto thesignedAttrsarray ofsi, allocating a new array if necessary.CMS_signed_add1_attr_by_NID(),CMS_signed_add1_attr_by_OBJ(), andCMS_signed_add1_attr_by_txt()β create a new X.501 Attribute object usingX509_ATTRIBUTE_create_by_NID(3),X509_ATTRIBUTE_create_by_OBJ(3), orX509_ATTRIBUTE_create_by_txt(3), respectively, and append it to thesignedAttrsarray ofsi.CMS_signed_delete_attr()β deletes the element with the zero-basedlocinsignedAttrsofsi.CMS_signed_get0_data_by_OBJ(),CMS_signed_get_attr_by_NID(), andCMS_signed_get_attr_by_OBJ()β search the array starting after the indexstart_after. They fail if no matching object is found.CMS_signed_get0_data_by_OBJ()also fails if the data is not of the requestedtype.- special
start_afterbehavior forCMS_signed_get0_data_by_OBJ()β ifstart_afteris-2or smaller, the function also fails if thesignedAttrsarray ofsicontains more than one matching object. Ifstart_afteris-3or smaller, it also fails unless the matching object contains exactly one value. iconic levels of picky, honestly β¨ CMS_signed_get_attr()β returns the array element at the zero-basedloc. It fails if thelocargument is negative or greater than or equal to the number of objects in the array.CMS_signed_get_attr_count()β returns the number of objects currently stored in thesignedAttrsarray ofsi.
π RETURN VALUES π
CMS_signed_add1_attr(), CMS_signed_add1_attr_by_NID(), CMS_signed_add1_attr_by_OBJ(), CMS_signed_add1_attr_by_txt(), CMS_unsigned_add1_attr(), CMS_unsigned_add1_attr_by_NID(), CMS_unsigned_add1_attr_by_OBJ(), and CMS_unsigned_add1_attr_by_txt() return 1 for success or 0 if an error occurs.
CMS_signed_delete_attr() returns the deleted element or NULL if the signedAttrs array is NULL, or if the requested loc argument is negative, or greater than or equal to the number of objects in it.
CMS_unsigned_delete_attr() returns the deleted element or NULL if the unsignedAttrs array is NULL, or if the requested loc argument is negative, or greater than or equal to the number of objects in it.
CMS_signed_get0_data_by_OBJ() and CMS_unsigned_get0_data_by_OBJ() return an internal pointer to the data contained in the value of the first object that has an index greater than start_after and a type matching type, or NULL on failure.
CMS_signed_get_attr() and CMS_unsigned_get_attr() return an internal pointer or NULL on failure.
CMS_signed_get_attr_by_NID(), CMS_signed_get_attr_by_OBJ(), CMS_unsigned_get_attr_by_NID(), and CMS_unsigned_get_attr_by_OBJ() return the index of the first object in the array that has an index greater than start_after and a type matching nid or oid, respectively, or -1 on failure. In addition, CMS_signed_get_attr_by_OBJ() and CMS_unsigned_get_attr_by_OBJ() return -2 if OBJ_nid2obj(3) fails on the requested nid.
CMS_signed_get_attr_count() and CMS_unsigned_get_attr_count() return the number of array elements or -1 on failure.
bestie note: yes, the return-values section really saysCMS_signed_get_attr_by_OBJ()andCMS_unsigned_get_attr_by_OBJ()return-2ifOBJ_nid2obj(3)fails on the requestednidβ I am just reporting the facts, no cap π
πΈ SEE ALSO πΈ
CMS_add1_signer(3)CMS_ContentInfo_new(3)CMS_get0_SignerInfos(3)OBJ_nid2obj(3)X509_ATTRIBUTE_create_by_OBJ(3)X509_ATTRIBUTE_new(3)
π STANDARDS π
- RFC 5652: Cryptographic Message Syntax (CMS)
- section 5.3: SignerInfo Type
- section 11: Useful Attributes
π HISTORY π
These functions first appeared in OpenSSL 0.9.9 and have been available since OpenBSD 6.6. legacy behavior but make it fashion π
okay that is the whole page, bestie! This Debian manual page is dated June 13, 2025, and the manual name is CMS_SIGNED_ADD1_ATTR(3) β stay signed, stay slay, and may your signedAttrs always be immaculate π«Άβ¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2024 Job Snijders <job@openbsd.org>
- Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
- Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms