ASN1_ITEM_NEW(3ossl)

πŸ’– ASN1_ITEM_NEW β€” the OpenSSL manual, but make it make sense πŸ’–

okay so bestie, this is the ASN1_ITEM_NEW(3ossl) page from the OpenSSL manual, and it's genuinely so chill. Two lil functions that build you a brand new ASN.1 value from a template. That's it. That's the whole vibe. Let's go πŸ¦‹


✨ NAME ✨

ASN1_item_new_ex, ASN1_item_new β€” create new ASN.1 values

like… they make new ASN.1 values. the name is not playing games with you πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/asn1.h>

ASN1_VALUE *ASN1_item_new_ex(const ASN1_ITEM *it, OSSL_LIB_CTX *libctx,
                             const char *propq);
ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);

there they are. two of them. one has extra params, one is the low-effort version. both iconic πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

So ASN1_item_new_ex() creates a fresh new ASN1_VALUE structure, and it builds it off the ASN1_ITEM template you hand it in the it parameter. The template is basically the blueprint, she's just following the instructions πŸ“‹βœ¨

Now here's the tea: if the process ends up needing to do any algorithm fetches along the way, those fetches will use the OSSL_LIB_CTX you passed in libctx, plus the property query string in propq. If you wanna actually understand algorithm fetching (and honestly, valid), go read "ALGORITHM FETCHING" in crypto(7) β€” it's all laid out there, no cap πŸ“š

And ASN1_item_new()? It's literally the same as ASN1_item_new_ex(), except it uses the default OSSL_LIB_CTX (so that's NULL) and a NULL property query string. Same energy, fewer arguments, she's low maintenance 🫢


πŸ”₯ RETURN VALUES πŸ”₯

Both ASN1_item_new_ex() and ASN1_item_new() return a pointer to the newly created ASN1_VALUE.

Or they return NULL on error. And bestie, if you get NULL, that's not a vibe β€” go check what went wrong 😭


⭐ HISTORY ⭐

The function ASN1_item_new_ex() was added in OpenSSL 3.0. So if you're on something older, she does not exist for you, sorry πŸ’€


Copyright 2021 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, that's the whole page. every flag, every param, every NULL, all of it. nothing skipped, nothing invented. iykyk πŸ’–

mwah πŸ’‹ this was ASN1_ITEM_NEW(3ossl) from OpenSSL 3.5.9, dated 2026-09-29. go build something cute with it, bestie πŸŒˆπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from