summaryrefslogtreecommitdiff
path: root/doc/man/asn1_read_value.3
blob: 7ccb411c1cea85cce5d51d6e2f8096c356900a7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.\" DO NOT MODIFY THIS FILE!  It was generated by gdoc.
.TH "asn1_read_value" 3 "4.19.0" "libtasn1" "libtasn1"
.SH NAME
asn1_read_value \- API function
.SH SYNOPSIS
.B #include <libtasn1.h>
.sp
.BI "int asn1_read_value(asn1_node_const " root ", const char * " name ", void * " ivalue ", int * " len ");"
.SH ARGUMENTS
.IP "asn1_node_const root" 12
pointer to a structure.
.IP "const char * name" 12
the name of the element inside a structure that you want to read.
.IP "void * ivalue" 12
vector that will contain the element's content, must be a
pointer to memory cells already allocated (may be \fBNULL\fP).
.IP "int * len" 12
number of bytes of *value: value[0]..value[len\-1]. Initialy
holds the sizeof value.
.SH "DESCRIPTION"
Returns the value of one element inside a structure.
If an element is OPTIONAL and this returns
\fBASN1_ELEMENT_NOT_FOUND\fP, it means that this element wasn't present
in the der encoding that created the structure.  The first element
of a SEQUENCE_OF or SET_OF is named "?1". The second one "?2" and
so on. If the  \fIroot\fP provided is a node to specific sequence element,
then the keyword "?CURRENT" is also acceptable and indicates the
current sequence element of this node.

Note that there can be valid values with length zero. In these case
this function will succeed and  \fIlen\fP will be zero.
.SH "INTEGER"
VALUE will contain a two's complement form integer.

integer=\-1  \-> value[0]=0xFF , len=1.
integer=1   \-> value[0]=0x01 , len=1.
.SH "ENUMERATED"
As INTEGER (but only with not negative numbers).
.SH "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
.SH "UTCTIME"
VALUE will be a null terminated string in one of these
formats: "YYMMDDhhmmss+hh'mm'" or "YYMMDDhhmmss\-hh'mm'".
LEN=strlen(VALUE)+1.
.SH "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.
.SH "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.
.SH "CHOICE"
If NAME indicates a choice type, VALUE will specify the
alternative selected.
.SH "ANY"
If NAME indicates an any type, VALUE will indicate the DER
encoding of the structure actually used.
.SH "RETURNS"
\fBASN1_SUCCESS\fP if value is returned,
\fBASN1_ELEMENT_NOT_FOUND\fP if  \fIname\fP is not a valid element,
\fBASN1_VALUE_NOT_FOUND\fP if there isn't any value for the element
selected, and \fBASN1_MEM_ERROR\fP if The value vector isn't big enough
to store the result, and in this case  \fIlen\fP will contain the number of
bytes needed. On the occasion that the stored data are of zero\-length
this function may return \fBASN1_SUCCESS\fP even if the provided  \fIlen\fP is zero.
.SH COPYRIGHT
Copyright \(co 2006-2022 Free Software Foundation, Inc..
.br
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.
.SH "SEE ALSO"
The full documentation for
.B libtasn1
is maintained as a Texinfo manual.  If the
.B info
and
.B libtasn1
programs are properly installed at your site, the command
.IP
.B info libtasn1
.PP
should give you access to the complete manual.
As an alternative you may obtain the manual from:
.IP
.B https://www.gnu.org/software/libtasn1/manual/
.PP