1asn1_read_value(3) libtasn1 asn1_read_value(3)
2
3
4
6 asn1_read_value - API function
7
9 #include <libtasn1.h>
10
11 int asn1_read_value(asn1_node root, const char * name, void * ivalue,
12 int * len);
13
15 asn1_node root
16 pointer to a structure.
17
18 const char * name
19 the name of the element inside a structure that you want to
20 read.
21
22 void * ivalue
23 vector that will contain the element's content, must be a
24 pointer to memory cells already allocated (may be NULL).
25
26 int * len number of bytes of *value: value[0]..value[len-1]. Initialy
27 holds the sizeof value.
28
30 Returns the value of one element inside a structure. If an element is
31 OPTIONAL and this returns ASN1_ELEMENT_NOT_FOUND, it means that this
32 element wasn't present in the der encoding that created the structure.
33 The first element of a SEQUENCE_OF or SET_OF is named "?1". The second
34 one "?2" and so on. If the root provided is a node to specific
35 sequence element, then the keyword "?CURRENT" is also acceptable and
36 indicates the current sequence element of this node.
37
38 Note that there can be valid values with length zero. In these case
39 this function will succeed and len will be zero.
40
42 VALUE will contain a two's complement form integer.
43
44 integer=-1 -> value[0]=0xFF , len=1. integer=1 -> value[0]=0x01 ,
45 len=1.
46
48 As INTEGER (but only with not negative numbers).
49
51 VALUE will be the null terminated string "TRUE" or "FALSE" and LEN=5 or
52 LEN=6.
53
54 OBJECT IDENTIFIER: VALUE will be a null terminated string with each
55 number separated by a dot (i.e. "1.2.3.543.1").
56
57 LEN = strlen(VALUE)+1
58
60 VALUE will be a null terminated string in one of these formats: "YYMMD‐
61 Dhhmmss+hh'mm'" or "YYMMDDhhmmss-hh'mm'". LEN=strlen(VALUE)+1.
62
64 VALUE will be a null terminated string in the same format used to set
65 the value.
66
67 OCTET STRING: VALUE will contain the octet string and LEN will be the
68 number of octets.
69
71 VALUE will contain the generalstring and LEN will be the number of
72 octets.
73
74 BIT STRING: VALUE will contain the bit string organized by bytes and
75 LEN will be the number of bits.
76
78 If NAME indicates a choice type, VALUE will specify the alternative
79 selected.
80
82 If NAME indicates an any type, VALUE will indicate the DER encoding of
83 the structure actually used.
84
86 ASN1_SUCCESS if value is returned, ASN1_ELEMENT_NOT_FOUND if name is
87 not a valid element, ASN1_VALUE_NOT_FOUND if there isn't any value for
88 the element selected, and ASN1_MEM_ERROR if The value vector isn't big
89 enough to store the result, and in this case len will contain the num‐
90 ber of bytes needed.
91
93 Copyright © 2006-2015 Free Software Foundation, Inc..
94 Copying and distribution of this file, with or without modification,
95 are permitted in any medium without royalty provided the copyright
96 notice and this notice are preserved.
97
99 The full documentation for libtasn1 is maintained as a Texinfo manual.
100 If the info and libtasn1 programs are properly installed at your site,
101 the command
102
103 info libtasn1
104
105 should give you access to the complete manual. As an alternative you
106 may obtain the manual from:
107
108 http://www.gnu.org/software/libtasn1/manual/
109
110libtasn1 4.8 asn1_read_value(3)