LIBRESSL-X509_ATTRIBUTE_GET0_OBJECT(3)
π X509_ATTRIBUTE_GET0_OBJECT β X.501 Attribute read accessors
okay bestie, so this page lives in the Library Functions Manual and it's literally all about peeking inside an X.501 Attribute without messing with it. read-only vibes only, no cap π
β¨ NAME β¨
X509_ATTRIBUTE_get0_object, X509_ATTRIBUTE_count, X509_ATTRIBUTE_get0_type, X509_ATTRIBUTE_get0_data β the X.501 Attribute read accessors π
π¦ SYNOPSIS π¦
first things first, you're gonna need the libcrypto library:
#include <openssl/x509.h>
then the four icons themselves:
ASN1_OBJECT *
X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
int
X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr);
ASN1_TYPE *
X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int index);
void *
X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int index, int type,
void *data);
πΈ DESCRIPTION πΈ
so these four functions are your little read-only besties for the X.501 Attribute object attr β they let you look at stuff inside it without touching anything. peek but don't poke, yk? π
now for X509_ATTRIBUTE_get0_data(), there's a thing: the type argument is usually one of the V_ASN1_* constants, and those cuties live in <openssl/asn1.h>. like, say you're expecting a return value of the type ASN1_OCTET_STRING β bestie, you pass V_ASN1_OCTET_STRING as the type argument. match made in heaven β¨
and the data argument? it's literally ignored. like, it's giving decoration. passing NULL is recommended so nobody gets confused π
π₯ RETURN VALUES π₯
X509_ATTRIBUTE_get0_object()gives you an internal pointer to the type ofattr, orNULLifattrisNULLor if its type isn't set. no type, no pointer, periodt.X509_ATTRIBUTE_count()hands back how many values are stored inattr, or0if no value or values are set. zero vibes.X509_ATTRIBUTE_get0_type()returns an internal pointer to the ASN.1 ANY object representing the value at the given zero-basedindex, orNULLifattrisNULL, or ifindexis larger than or equal to the number of values stored inattr, or if no value or values are set. so many ways to getNULL, honestly πX509_ATTRIBUTE_get0_data()gives you an internal pointer to the data contained in the value at the given zero-basedindex, orNULLifattrisNULL, or ifindexis larger than or equal to the number of values stored inattr, or if no value or values are set, or if the ASN.1 ANY object representing the value with the givenindexis not of the requestedtype. that last one is the sneaky one ngl π
π SEE ALSO π
ASN1_OBJECT_new(3)ASN1_TYPE_new(3)OPENSSL_sk_new(3)X509_ATTRIBUTE_new(3)X509_ATTRIBUTE_set1_object(3)
go read those next, iykyk π«Ά
π HISTORY π
these functions first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7. iconic longevity honestly β
and that's the whole page bestie, slay π this edition came from Debian and is dated June 8, 2025 β the page being X509_ATTRIBUTE_GET0_OBJECT(3) ofc. go forth and read your attributes, main character π§ββοΈπ
π¦ 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) 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