asn1_read_value_type(3)
π NAME π
asn1_read_value_type β it's an API function, bestie, from the libtasn1 manual, and yes we're gonna read a value AND get its type at the same time. main character behavior honestly π
β¨ SYNOPSIS β¨
#include <libtasn1.h>
int asn1_read_value_type(asn1_node_const root, const char * name, void *
ivalue, int * len, unsigned int * etype);
like. okay. look at that signature. she's gorgeous. π«Ά
πΈ ARGUMENTS πΈ
asn1_node_const rootβ pointer to a structure. that's your entry point babes, the whole tree lives here.const char * nameβ the name of the element inside a structure that you want to read. i.e. which lil guy inside the tree are we peeking at πvoid * ivalueβ vector that will contain the element's content. heads up: it must be a pointer to memory cells you already allocated (it may beNULLthough, so no stress there).int * lenβ number of bytes of*value:value[0]..value[len-1]. Initially holds thesizeofvalue. so like, you tell it how much room you got, and it tells you what it actually used.unsigned int * etypeβ The type of the value read (ASN1_ETYPE). the receipts on what kind of thing you just got back β¨
π DESCRIPTION π
Returns the type and value of one element inside a structure. If an element is OPTIONAL and this returns ASN1_ELEMENT_NOT_FOUND, it means that this element wasn't present in the der encoding that created the structure. (so like, it's not an error error, it's just... not there. she ghosted. π)
The first element of a SEQUENCE_OF or SET_OF is named "?1". The second one "?2" and so on. And if the root provided is a node to specific sequence element, then the keyword "?CURRENT" is also acceptable and indicates the current sequence element of this node. iykyk π§
Note that there can be valid values with length zero. In these case this function will succeed and len will be zero. so a zero is not a fail, bestie, it's just a zero. periodt.
π₯ INTEGER
VALUE will contain a two's complement form integer.
integer=-1 -> value[0]=0xFF , len=1. integer=1 -> value[0]=0x01 ,
len=1.
π₯ ENUMERATED
As INTEGER (but only with not negative numbers). so like, no negatives allowed here, sorry girlies β
π₯ BOOLEAN
VALUE will be the null terminated string "TRUE" or "FALSE" and LEN=5 or LEN=6.
OBJECT IDENTIFIER: VALUE will be a null terminated string with each number separated by a dot (i.e. "1.2.3.543.1").
LEN = strlen(VALUE)+1
π₯ UTCTIME
VALUE will be a null terminated string in one of these formats: "YYMMDDhhmmss+hh'mm'" or "YYMMDDhhmmss-hh'mm'". LEN=strlen(VALUE)+1.
π₯ GENERALIZEDTIME
VALUE will be a null terminated string in the same format used to set the value.
OCTET STRING: VALUE will contain the octet string and LEN will be the number of octets.
GENERALSTRING
VALUE will contain the generalstring and LEN will be the number of octets.
BIT STRING: VALUE will contain the bit string organized by bytes and LEN will be the number of bits.
π₯ CHOICE
If NAME indicates a choice type, VALUE will specify the alternative selected. (choose your fighter π
)
π₯ ANY
If NAME indicates an any type, VALUE will indicate the DER encoding of the structure actually used.
π RETURNS π
ASN1_SUCCESSif value is returned β slay, we got it β¨ASN1_ELEMENT_NOT_FOUNDifnameis not a valid elementASN1_VALUE_NOT_FOUNDif there isn't any value for the element selectedASN1_MEM_ERRORif The value vector isn't big enough to store the result, and in this caselenwill contain the number of bytes needed. (rude of you to not allocate enough but ok, she's telling you the size now π)
On the occasion that the stored data are of zero-length this function may return ASN1_SUCCESS even if the provided len is zero.
π COPYRIGHT π
Copyright Β© 2006-2025 Free Software Foundation, Inc..
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
π SEE ALSO π
The full documentation for libtasn1 is maintained as a Texinfo manual. If the info and libtasn1 programs are properly installed at your site, the command
info libtasn1
should give you access to the complete manual. As an alternative you may obtain the manual from:
https://www.gnu.org/software/libtasn1/manual/
and that's the whole page bestie!! π¦ this one's from libtasn1, version 4.21.0, and it lives under the name asn1_read_value_type(3) in the manual β go read it, go call it, go absolutely devour it. mwah π
π¦ where this page comes from
- alpine 3.22: libtasn1-doc 4.21.0-r0 Β· LGPL-2.1-or-later
- alpine 3.23: libtasn1-doc 4.21.0-r0 Β· LGPL-2.1-or-later
- alpine 3.24: libtasn1-doc 4.21.0-r0 Β· LGPL-2.1-or-later
- arch rolling: libtasn1 4.21.0-1 Β· GPL-3.0-or-later AND LGPL-2.1-or-later AND GFDL-1.3-or-later
- fedora 43: libtasn1-devel 4.21.0-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: libtasn1-devel 4.21.0-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: libtasn1-devel 4.21.0-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: libtasn1-devel 4.21.0-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: libtasn1-devel 4.21.0-160000.1.1 Β· GFDL-1.3-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: libtasn1-devel 4.21.0-160000.1.1 Β· GFDL-1.3-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: libtasn1-devel 4.21.0-160000.1.1 Β· GFDL-1.3-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: libtasn1-devel 4.21.0-160000.1.1 Β· GFDL-1.3-or-later AND LGPL-2.1-or-later
- ubuntu resolute: libtasn1-6-dev 4.21.0-2
- ubuntu stonking: libtasn1-6-dev 4.21.0-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms