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_const root, const char * name, void *
12 ivalue, int * len);
13
15 asn1_node_const 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. On the occasion that the stored data are of
91 zero-length this function may return ASN1_SUCCESS even if the provided
92 len is zero.
93
95 Copyright © 2006-2015 Free Software Foundation, Inc..
96 Copying and distribution of this file, with or without modification,
97 are permitted in any medium without royalty provided the copyright
98 notice and this notice are preserved.
99
101 The full documentation for libtasn1 is maintained as a Texinfo manual.
102 If the info and libtasn1 programs are properly installed at your site,
103 the command
104
105 info libtasn1
106
107 should give you access to the complete manual. As an alternative you
108 may obtain the manual from:
109
110 http://www.gnu.org/software/libtasn1/manual/
111
112libtasn1 4.16.0 asn1_read_value(3)