X509_ACERT_ADD1_ATTR(3ossl)

πŸ’– X509_ACERT_ADD1_ATTR πŸ’–

okay bestie, so this is the X509_ACERT_ADD1_ATTR(3ossl) page from the OpenSSL manual, and it's all about wrangling attributes on an X509_ACERT. yes that's the Attribute Certificate thing. we're adding attributes, we're deleting attributes, we're being the main character of certificate metadata. let's GO πŸŽ€


✨ NAME ✨

X509_ACERT_add1_attr, X509_ACERT_add1_attr_by_NID, X509_ACERT_add1_attr_by_OBJ, X509_ACERT_add1_attr_by_txt, X509_ACERT_delete_attr β€” the X509_ACERT attribute functions πŸ¦‹


🌸 SYNOPSIS 🌸

#include <openssl/x509_acert.h>

int X509_ACERT_add1_attr(X509_ACERT *x, X509_ATTRIBUTE *attr);
int X509_ACERT_add1_attr_by_NID(X509_ACERT *x, int nid, int type,
                                const void *bytes, int len);
int X509_ACERT_add1_attr_by_OBJ(X509_ACERT *x, const ASN1_OBJECT *obj,
                                int type, const void *bytes, int len);
int X509_ACERT_add1_attr_by_txt(X509_ACERT *x, const char *attrname, int type,
                                const unsigned char *bytes, int len);
X509_ATTRIBUTE *X509_ACERT_delete_attr(X509_ACERT *x, int loc);

πŸ’… DESCRIPTION πŸ’…

so like, five little besties, all here to help you handle attributes on your ACERT. here's the tea, one by one πŸ“

  • X509_ACERT_add1_attr() β€” takes an already-constructed X509_ATTRIBUTE called attr and adds it to the existing X509_ACERT structure x. that's it. drop it in, you're done πŸ’–
  • X509_ACERT_add1_attr_by_NID() and X509_ACERT_add1_attr_by_OBJ() β€” these two add an attribute of type nid or obj respectively, with a value of ASN1 type type, and that value gets constructed using len bytes taken from bytes. ngl, it's giving "I don't have a whole attribute object but I do have opinions" energy ✨
  • X509_ACERT_add1_attr_by_txt() β€” same vibe but the type is given as attrname, a string, and the value is ASN1 type type built from len bytes out of bytes. note bestie: this one takes a const unsigned char * while the NID and OBJ ones take a const void *. yes it's a whole thing, don't come for me, just copy the signature πŸ™ˆ
  • X509_ACERT_delete_attr() β€” deletes the loc-th attribute from x and hands you back a pointer to it. but if x has fewer than loc attributes in it? you get NULL. so rude but so valid πŸ’€

⭐ RETURN VALUES ⭐

X509_ACERT_add1_attr(), X509_ACERT_add1_attr_by_NID(), and X509_ACERT_add1_attr_by_OBJ() return 1 for success and 0 for failure. slay or flop, no in-between 🫢

X509_ACERT_delete_attr() returns an X509_ATTRIBUTE pointer on success, or NULL on failure. that's the whole contract. periodt πŸ‘‘


🌈 SEE ALSO 🌈

X509_ACERT_get_attr_count(3) β€” go check how many attributes you actually have, bestie 🧚


πŸ‘‘ HISTORY πŸ‘‘

X509_ACERT_add1_attr(), X509_ACERT_add1_attr_by_NID(), X509_ACERT_add1_attr_by_OBJ(), X509_ACERT_add1_attr_by_txt() and X509_ACERT_delete_attr() were all added in OpenSSL 3.4. iconic, honestly πŸ’œ


Copyright 2023-2024 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>.

fr fr, read the license, it's not optional and it's not that long πŸ’…

and that's the whole page, bestie!! this was OpenSSL 3.5.9, dated 2026-09-29, and the page itself is X509_ACERT_ADD1_ATTR(3ossl) β€” go forth and attribute responsibly βœ¨πŸ’–πŸ¦‹

πŸ“¦ where this page comes from