1asn1_write_value(3) libtasn1 asn1_write_value(3)
2
3
4
6 asn1_write_value - Set the value of one element inside a structure.
7
9 #include <libtasn1.h>
10
11 asn1_retCode asn1_write_value(ASN1_TYPE node_root, const char * name,
12 const void * ivalue, int len);
13
15 ASN1_TYPE node_root
16 pointer to a structure
17
18 const char * name
19 the name of the element inside the structure that you want
20 to set.
21
22 const void * ivalue
23 vector used to specify the value to set. If len is >0,
24 VALUE must be a two's complement form integer. if len=0
25 *VALUE must be a null terminated string with an integer
26 value.
27
28 int len number of bytes of *value to use to set the value:
29 value[0]..value[len-1] or 0 if value is a null terminated
30 string
31
33 Set the value of one element inside a structure.
34
35 If an element is OPTIONAL and you want to delete it, you must use the
36 value=NULL and len=0. Using "pkix.asn":
37
38 result=asn1_write_value(cert, "tbsCertificate.issuerUniqueID", NULL,
39 0);
40
43 VALUE must contain a two's complement form integer.
44
45 value[0]=0xFF , len=1 -> integer=-1. value[0]=0xFF
46 value[1]=0xFF , len=2 -> integer=-1. value[0]=0x01 ,
47 len=1 -> integer= 1. value[0]=0x00 value[1]=0x01 , len=2 -> integer=
48 1. value="123" , len=0 -> integer= 123.
49
51 As INTEGER (but only with not negative numbers).
52
54 VALUE must be the null terminated string "TRUE" or "FALSE" and LEN !=
55 0.
56
57 value="TRUE" , len=1 -> boolean=TRUE. value="FALSE" , len=1 -> bool‐
58 ean=FALSE.
59
61 VALUE must be a null terminated string with each number separated by a
62 dot (e.g. "1.2.3.543.1"). LEN != 0.
63
64 value="1 2 840 10040 4 3" , len=1 -> OID=dsa-with-sha.
65
67 VALUE must be a null terminated string in one of these formats: "YYMMD‐
68 DhhmmssZ", "YYMMDDhhmmssZ", "YYMMDDhhmmss+hh'mm'", "YYMMDDhh‐
69 mmss-hh'mm'", "YYMMDDhhmm+hh'mm'", or "YYMMDDhhmm-hh'mm'". LEN != 0.
70
71 value="9801011200Z" , len=1 -> time=Jannuary 1st, 1998 at 12h 00m
72 Greenwich Mean Time
73
75 VALUE must be in one of this format: "YYYYMMDDhhmmss.sZ", "YYYYMMDDhh‐
76 mmss.sZ", "YYYYMMDDhhmmss.s+hh'mm'", "YYYYMMDDhhmmss.s-hh'mm'", "YYYYM‐
77 MDDhhmm+hh'mm'", or "YYYYMMDDhhmm-hh'mm'" where ss.s indicates the sec‐
78 onds with any precision like "10.1" or "01.02". LEN != 0
79
80 value="2001010112001.12-0700" , len=1 -> time=Jannuary 1st, 2001 at 12h
81 00m 01.12s Pacific Daylight Time
82
84 VALUE conctains thce octetcstring and LEN is the number of octets.
85 k k k
86 value="$ssh$x01$ssh$x02$ssh$x03" , len=3 -> three bytes octet string
87 l l l
89 VALUE conctains thce generaclstring and LEN is the number of octets.
90 k k k
91 value="$ssh$x01$ssh$x02$ssh$x03" , len=3 -> three bytes generalstring
92 l l l
94 VALUE contains the bit string organized by bytes and LEN is the number
95 of bits.c
96 k
97 value="$ssh$xCF" , len=6 -> bit string="110011" (six bits)
98 l
100 if NAME indicates a choice type, VALUE must specify one of the alterna‐
101 tives with a null terminated string. LEN != 0. Using "pkix.asn"
102
103 result=asn1_write_value(cert, "certificate1.tbsCertificate.subject",
104 "rdnSequence", 1);
105
107 VALUE indicates the der encoding of a structure. LEN != 0.
108
110 VALUE must be the null terminated string "NEW" and LEN != 0. With this
111 instruction another element is appended in the sequence. The name of
112 this element will be "?1" if it's the first one, "?2" for the second
113 and so on.
114
115 Using "pkix.asn"
116
117 result=asn1_write_value(cert, "certificate1.tbsCertificate.sub‐
118 ject.rdnSequence", "NEW", 1);
119
121 the same as SEQUENCE OF. Using "pkix.asn":
122
123 result=asn1_write_value(cert, "tbsCertificate.subject.rdnSe‐
124 quence.?LAST", "NEW", 1);
125
128 Set value OK.
129
131 NAME is not a valid element.
132
134 VALUE has a wrong format.
135
137 Copyright © 2006 Free Software Foundation, Inc..
138 Permission is granted to make and distribute verbatim copies of this
139 manual provided the copyright notice and this permission notice are
140 preserved on all copies.
141
143 The full documentation for libtasn1 is maintained as a Texinfo manual.
144 If the info and libtasn1 programs are properly installed at your site,
145 the command
146
147 info libtasn1
148
149 should give you access to the complete manual.
150
151
152
153libtasn1 0.3.9 asn1_write_value(3)