X509_ACERT_ADD1_ATTR(3SSL)

πŸ’– X509_ACERT_ADD1_ATTR πŸ’–

okay bestie, sitteth down because we're gonna talk about the 3SSL corner of the manual β€” specifically the little family of functions that let you shove attributes onto an X509_ACERT like it's a scrapbook and you have ✨zero✨ impulse control (affectionately).

  • 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

these are the X509_ACERT attribute functions, and yes, that is literally the entire NAME section, we're keeping it, periodt. πŸŽ€


🌸 SYNOPSIS 🌸

first you gotta let the girl know where these live. include the header, no cap:

#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);

look at those signatures. iconic. not one of them changed. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

X509_ACERT_add1_attr() takes a constructed X509_ATTRIBUTE called attr and adds it to the existing X509_ACERT structure x. that's it. that's the whole job. constructed already? good, hand it over. 🫢

X509_ACERT_add1_attr_by_NID() and X509_ACERT_add1_attr_by_OBJ() are the DIY girlies: they add an attribute of type nid or obj respectively, with a value of ASN1 type type, and that value gets constructed using len bytes from bytes. so you're not passing a prebuilt attribute, you're building the vibe from raw bytes. 🧚

X509_ACERT_add1_attr_by_txt() is the same energy but you name it with text: it adds an attribute of type attrname with a value of ASN1 type type constructed using len bytes from bytes. text girlies, this one's for you. πŸ’œ

X509_ACERT_delete_attr() is the villain arc (but in a slay way). it will delete the locth attribute from x β€” and it returns a pointer to it. BUT, and listen closely, if x contains fewer than loc attributes, it returns NULL instead. so like... nothing to delete? no attribute for you. πŸ™ˆ


⭐ 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. one is the winner, zero is the L. πŸ”₯
  • X509_ACERT_delete_attr() returns a X509_ATTRIBUTE pointer on success, or NULL on failure. no attribute, no pointer, no joy.

πŸ‘‘ SEE ALSO πŸ‘‘


πŸ’€ 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. so they're fresh, they're new, they're the moment. ✨


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 bestie, read the license before you go touching this stuff. it's literally two sentences and it's not optional. 🫢

and that's the whole page, no notes, no edits, every flag and every word accounted for. this edition of the X509_ACERT_ADD1_ATTR(3SSL) manual page ships with OpenSSL 4.0.3, dated 2026-09-29 β€” go forth and add your attributes, main character. πŸ’…βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’–

πŸ“¦ where this page comes from