1asn1_read_value(3)                 libtasn1                 asn1_read_value(3)
2
3
4

NAME

6       asn1_read_value - Returns the value of one element inside a structure
7

SYNOPSIS

9       #include <libtasn1.h>
10
11       asn1_retCode  asn1_read_value(ASN1_TYPE root, const char * name, void *
12       ivalue, int * len);
13

ARGUMENTS

15       ASN1_TYPE 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.
25
26       int * len   number of bytes of *value: value[0]..value[len-1]. Initialy
27                   holds the sizeof value.
28

DESCRIPTION

30       Returns the value of one element inside a structure.
31
32       If  an  element  is  OPTIONAL  and  the  function  "read_value" returns
33       ASN1_ELEMENT_NOT_FOUND, it means that this element  wasn't  present  in
34       the  der  encoding  that created the structure.  The first element of a
35       SEQUENCE_OF or SET_OF is named "?1". The second one "?2" and so on.
36

INTEGER

38       VALUE will contain a two's complement form integer.
39
40       integer=-1  -> value[0]=0xFF , len=1.  integer=1   ->  value[0]=0x01  ,
41       len=1.
42

ENUMERATED

44       As INTEGER (but only with not negative numbers).
45

BOOLEAN

47       VALUE will be the null terminated string "TRUE" or "FALSE" and LEN=5 or
48       LEN=6.
49

OBJECT IDENTIFIER

51       VALUE will be a null terminated string with each number separated by  a
52       dot (i.e. "1.2.3.543.1").
53
54       LEN = strlen(VALUE)+1
55

UTCTIME

57       VALUE will be a null terminated string in one of these formats: "YYMMD‐
58       Dhhmmss+hh'mm'" or "YYMMDDhhmmss-hh'mm'".  LEN=strlen(VALUE)+1.
59

GENERALIZEDTIME

61       VALUE will be a null terminated string in the same format used  to  set
62       the value.
63

OCTET STRING

65       VALUE  will  contain  the  octet  string  and LEN will be the number of
66       octets.
67

GENERALSTRING

69       VALUE will contain the generalstring and LEN  will  be  the  number  of
70       octets.
71

BIT STRING

73       VALUE  will  contain  the bit string organized by bytes and LEN will be
74       the number of bits.
75

CHOICE

77       If NAME indicates a choice type, VALUE  will  specify  the  alternative
78       selected.
79

ANY

81       If  NAME indicates an any type, VALUE will indicate the DER encoding of
82       the structure actually used.
83

RETURNS

ASN1_SUCCESS

86       Set value OK.
87

ASN1_ELEMENT_NOT_FOUND

89       NAME is not a valid element.
90

ASN1_VALUE_NOT_FOUND

92       There isn't any value for the element selected.
93

ASN1_MEM_ERROR

95       The value vector isn't big enough to store the result.   In  this  case
96       LEN will contain the number of bytes needed.
97
99       Copyright © 2006, 2007, 2008, 2009 Free Software Foundation, Inc..
100       Copying  and  distribution  of this file, with or without modification,
101       are permitted in any medium  without  royalty  provided  the  copyright
102       notice and this notice are preserved.
103

SEE ALSO

105       The  full documentation for libtasn1 is maintained as a Texinfo manual.
106       If the info and libtasn1 programs are properly installed at your  site,
107       the command
108
109              info libtasn1
110
111       should give you access to the complete manual.
112
113
114
115libtasn1                              2.3                   asn1_read_value(3)
Impressum