X509V3_PARSE_LIST(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… X509V3_PARSE_LIST πŸ’…

okay so bestie, this is a page from libcrypto's part of the library functions manual, and today we're talking about X509V3_parse_list and X509V3_conf_free β€” the little duo that creates and destroys CONF_VALUE objects. yes that's the whole vibe. let's get into it 🫢


✨ SYNOPSIS ✨

first things first, you gotta pull in the library:

library β€œlibcrypto”
#include <openssl/x509v3.h>

then these two icons are at your service:

STACK_OF(CONF_VALUE) *
X509V3_parse_list(const char *string);

void
X509V3_conf_free(CONF_VALUE *conf);

πŸŽ€ DESCRIPTION πŸŽ€

X509V3_parse_list() takes your string, parses it, and allocates an array of CONF_VALUE objects. it follows these rules, no cap:

  1. the string gets split into fields at comma (',') characters. that's the delimiter, periodt.
  2. if a field contains a colon (':') character, then the part before the colon is treated as a name and the part after the first colon is the associated value. if there's no colon, the whole field is the name and NULL is used as the associated value. slay.
  3. for each name and each value, leading and trailing whitespace as defined by isspace(3) is ignored. literally just trimmed away πŸ’‡β€β™€οΈ
  4. parsing ends when a NUL, carriage return, or newline character shows up. that's the stop sign, iykyk.

so a new, empty STACK_OF(CONF_VALUE) gets allocated, and for each parsed name, one CONF_VALUE structure β€” with its optional value β€” is pushed onto it. every name gets its moment, main character energy for each one ✨


X509V3_conf_free() releases all the memory used by conf. and if conf is NULL, nothing happens β€” no action, no drama, no crash. we love a chill cleanup πŸ’œ

the typical way to release the memory that came back from X509V3_parse_list() is by calling sk_CONF_VALUE_pop_free() on it, and passing a pointer to the function X509V3_conf_free() as the second argument. match made in heaven fr fr 🫢


🌈 RETURN VALUES 🌈

X509V3_parse_list() returns the new STACK_OF(CONF_VALUE) object on success, or NULL if an error occurs. and bestie, the error situations are:

  • if there isn't any name at all 😭
  • if the name before a colon or after a comma is empty
  • if the value after a colon is empty
  • if memory allocation fails πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

isspace(3), sk_pop_free(3), STACK_OF(3), v2i_ASN1_BIT_STRING(3)

go read those next, you're gonna love them πŸ“


πŸ‘‘ HISTORY πŸ‘‘

X509V3_parse_list() and X509V3_conf_free() first appeared in OpenSSL 0.9.2 and have been available since OpenBSD 2.6. veterans. icons. absolute legends 🌸


and that's the page, bestie πŸŽ€ written up on the Debian side, dated June 8, 2025 β€” X509V3_PARSE_LIST(3), signing off πŸ’–βœ¨

πŸ“¦ where this page comes from