X509_ACERT_GET_ATTR(3ossl)

πŸ’– X509_ACERT_GET_ATTR πŸ’–

okay bestie, so this one is the OpenSSL page X509_ACERT_GET_ATTR(3ossl) and it's literally all about pulling attributes out of an X509_ACERT structure. group chat, open your notes app, we're doing this. πŸŽ€


✨ NAME ✨

X509_ACERT_get_attr, X509_ACERT_get_attr_by_NID, X509_ACERT_get_attr_by_OBJ, X509_ACERT_get_attr_count β€” the girlies that retrieve attributes from an X509_ACERT structure. yes, all four of them. squad goals. 🫢


🌸 SYNOPSIS 🌸

okay so first you gotta include the header, no cap:

#include <openssl/x509_acert.h>

X509_ATTRIBUTE *X509_ACERT_get_attr(const X509_ACERT *x, int loc);
int X509_ACERT_get_attr_by_NID(const X509_ACERT *x, int nid, int lastpos);
int X509_ACERT_get_attr_by_OBJ(const X509_ACERT *x, const ASN1_OBJECT *obj,
                               int lastpos);
int X509_ACERT_get_attr_count(const X509_ACERT *x);

look at those signatures. immaculate. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so X509_ACERT_get0_attr() retrieves the locth X509_ATTRIBUTE from an X509_ACERT x. and X509_ACERT_get_attr_count() hands you the total number of attributes</> in the X509_ACERT. the way that count is just right there for you. iconic. ✨

then we've got the duo: X509_ACERT_get_attr_by_NID() and X509_ACERT_get_attr_by_OBJ() β€” they retrieve the next attribute location matching nid or obj after lastpos. and babe, listen: lastpos should initially be set to -1. that's the starting line. 🏁

if there are no more entries, -1 is returned. and if nid is invalid (like, doesn't correspond to a valid OID) then -2 is returned. it's giving "not found" but make it spicy. πŸ’€


πŸ‘‘ RETURN VALUES πŸ‘‘

  • X509_ACERT_get0_attr() returns an X509_ATTRIBUTE from an attribute certificate, or NULL if the specified attribute is not found. sad girl hours. 😭
  • X509_ACERT_get_attr_by_NID() and X509_ACERT_get_attr_by_OBJ() return the location of the next attribute requested or -1 if not found.
  • X509_ACERT_get_attr_by_NID() can also return -2 if the supplied NID is invalid. yeah, it's got two moods.
  • X509_ACERT_get_attr_count() returns the number of attributes in the given attribute certificate. periodt.

🌈 HISTORY 🌈

X509_ACERT_get0_attr(), X509_ACERT_get_attr_by_NID(), X509_ACERT_get_attr_by_OBJ() and X509_ACERT_get_attr_count() were added in OpenSSL 3.4. so they're new-new. fresh off the block. πŸ’…


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>.

bestie this is the legal bit, don't skip it, the lawyers are watching πŸ‘€

and that's the whole page, bestie!! you ate. no crumbs. πŸ’…βœ¨

okay and for the little sign-off moment: this was version 3.5.9, dated 2026-09-29, and yeah β€” it's the X509_ACERT_GET_ATTR(3ossl) page. slay, go read some attributes, ily πŸ«ΆπŸ’–πŸŒˆ

πŸ“¦ where this page comes from