~ubuntu-branches/ubuntu/trusty/libtasn1-3/trusty

« back to all changes in this revision

Viewing changes to doc/texi/decoding.c.texi

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2006-06-07 20:14:52 UTC
  • Revision ID: james.westby@ubuntu.com-20060607201452-7a9dojyu7i2kfbyp
Tags: upstream-0.3.4
ImportĀ upstreamĀ versionĀ 0.3.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@deftypefun {signed long} {asn1_get_length_der} (const unsigned char * @var{der}, int @var{der_len}, int * @var{len})
 
2
@var{der}: DER data to decode.
 
3
 
 
4
@var{der_len}: Length of DER data to decode.
 
5
 
 
6
@var{len}: Output variable containing the length of the DER length field.
 
7
 
 
8
Extract a length field from DER data.
 
9
 
 
10
@strong{Return value:} Return the decoded length value, or -1 on indefinite
 
11
length, or -2 when the value was too big.
 
12
@end deftypefun
 
13
 
 
14
@deftypefun {int} {asn1_get_tag_der} (const unsigned char * @var{der}, int @var{der_len}, unsigned char * @var{class}, int * @var{len}, unsigned long * @var{tag})
 
15
@var{der}: DER data to decode.
 
16
 
 
17
@var{der_len}: Length of DER data to decode.
 
18
 
 
19
@var{class}: Output variable containing decoded class.
 
20
 
 
21
@var{len}: Output variable containing the length of the DER TAG data.
 
22
 
 
23
@var{tag}: Output variable containing the decoded tag.
 
24
 
 
25
Decode the class and TAG from DER code.
 
26
 
 
27
@strong{Return value:} Returns ASN1_SUCCESS on success, or an error.
 
28
@end deftypefun
 
29
 
 
30
@deftypefun {int} {asn1_get_octet_der} (const unsigned char * @var{der}, int @var{der_len}, int * @var{ret_len}, unsigned char * @var{str}, int @var{str_size}, int * @var{str_len})
 
31
@var{der}: DER data to decode containing the OCTET SEQUENCE.
 
32
 
 
33
@var{der_len}: Length of DER data to decode.
 
34
 
 
35
@var{ret_len}: Output variable containing the length of the DER data.
 
36
 
 
37
@var{str}: Pre-allocated output buffer to put decoded OCTET SEQUENCE in.
 
38
 
 
39
@var{str_size}: Length of pre-allocated output buffer.
 
40
 
 
41
@var{str_len}: Output variable containing the length of the OCTET SEQUENCE.
 
42
 
 
43
Extract an OCTET SEQUENCE from DER data.
 
44
 
 
45
@strong{Return value:} Returns ASN1_SUCCESS on success, or an error.
 
46
@end deftypefun
 
47
 
 
48
@deftypefun {int} {asn1_get_bit_der} (const unsigned char * @var{der}, int @var{der_len}, int * @var{ret_len}, unsigned char * @var{str}, int @var{str_size}, int * @var{bit_len})
 
49
@var{der}: DER data to decode containing the BIT SEQUENCE.
 
50
 
 
51
@var{der_len}: Length of DER data to decode.
 
52
 
 
53
@var{ret_len}: Output variable containing the length of the DER data.
 
54
 
 
55
@var{str}: Pre-allocated output buffer to put decoded BIT SEQUENCE in.
 
56
 
 
57
@var{str_size}: Length of pre-allocated output buffer.
 
58
 
 
59
@var{bit_len}: Output variable containing the size of the BIT SEQUENCE.
 
60
 
 
61
Extract a BIT SEQUENCE from DER data.
 
62
 
 
63
@strong{Return value:} Return ASN1_SUCCESS on success, or an error.
 
64
@end deftypefun
 
65
 
 
66
@deftypefun {asn1_retCode} {asn1_der_decoding} (ASN1_TYPE * @var{element}, const void * @var{ider}, int @var{len}, char * @var{errorDescription})
 
67
@var{element}: pointer to an ASN1 structure.
 
68
 
 
69
@var{ider}: vector that contains the DER encoding.
 
70
 
 
71
@var{len}: number of bytes of *@code{ider}: @code{ider}[0]..@code{ider}[len-1].
 
72
 
 
73
@var{errorDescription}: null-terminated string contains details when an
 
74
error occurred.
 
75
 
 
76
Fill the structure *ELEMENT with values of a DER encoding
 
77
string. The sructure must just be created with function
 
78
'create_stucture'.  If an error occurs during the decoding
 
79
procedure, the *ELEMENT is deleted and set equal to
 
80
@code{ASN1_TYPE_EMPTY}.
 
81
 
 
82
@strong{Returns:} 
 
83
@strong{ASN1_SUCCESS:} DER encoding OK.
 
84
 
 
85
@strong{ASN1_ELEMENT_NOT_FOUND:} ELEMENT is ASN1_TYPE_EMPTY.
 
86
 
 
87
ASN1_TAG_ERROR,ASN1_DER_ERROR: The der encoding doesn't match
 
88
the structure NAME. *ELEMENT deleted.
 
89
@end deftypefun
 
90
 
 
91
@deftypefun {asn1_retCode} {asn1_der_decoding_element} (ASN1_TYPE * @var{structure}, const char * @var{elementName}, const void * @var{ider}, int @var{len}, char * @var{errorDescription})
 
92
@var{structure}: pointer to an ASN1 structure
 
93
 
 
94
@var{elementName}: name of the element to fill
 
95
 
 
96
@var{ider}: vector that contains the DER encoding of the whole structure.
 
97
 
 
98
@var{len}: number of bytes of *der: der[0]..der[len-1]
 
99
 
 
100
@var{errorDescription}: null-terminated string contains details when an
 
101
error occurred.
 
102
 
 
103
Fill the element named ELEMENTNAME with values of a DER encoding
 
104
string.  The sructure must just be created with function
 
105
'create_stucture'.  The DER vector must contain the encoding
 
106
string of the whole STRUCTURE.  If an error occurs during the
 
107
decoding procedure, the *STRUCTURE is deleted and set equal to
 
108
@code{ASN1_TYPE_EMPTY}.
 
109
 
 
110
@strong{Returns:} 
 
111
@strong{ASN1_SUCCESS:} DER encoding OK.
 
112
 
 
113
@strong{ASN1_ELEMENT_NOT_FOUND:} ELEMENT is ASN1_TYPE_EMPTY or
 
114
elementName == NULL.
 
115
 
 
116
ASN1_TAG_ERROR,ASN1_DER_ERROR: The der encoding doesn't match
 
117
the structure STRUCTURE. *ELEMENT deleted.
 
118
@end deftypefun
 
119
 
 
120
@deftypefun {asn1_retCode} {asn1_der_decoding_startEnd} (ASN1_TYPE @var{element}, const void * @var{ider}, int @var{len}, const char * @var{name_element}, int * @var{start}, int * @var{end})
 
121
@var{element}: pointer to an ASN1 element
 
122
 
 
123
@var{ider}: vector that contains the DER encoding.
 
124
 
 
125
@var{len}: number of bytes of *@code{ider}: @code{ider}[0]..@code{ider}[len-1]
 
126
 
 
127
@var{name_element}: an element of NAME structure.
 
128
 
 
129
@var{start}: the position of the first byte of NAME_ELEMENT decoding
 
130
(@code{ider}[*start])
 
131
 
 
132
@var{end}: the position of the last byte of NAME_ELEMENT decoding
 
133
(@code{ider}[*end])
 
134
 
 
135
Find the start and end point of an element in a DER encoding
 
136
string. I mean that if you have a der encoding and you have
 
137
already used the function "asn1_der_decoding" to fill a structure,
 
138
it may happen that you want to find the piece of string concerning
 
139
an element of the structure.
 
140
 
 
141
@strong{Example:} the sequence "tbsCertificate" inside an X509 certificate.
 
142
 
 
143
@strong{Returns:} 
 
144
@strong{ASN1_SUCCESS:} DER encoding OK.
 
145
 
 
146
@strong{ASN1_ELEMENT_NOT_FOUND:} ELEMENT is ASN1_TYPE EMPTY or
 
147
NAME_ELEMENT is not a valid element.
 
148
 
 
149
ASN1_TAG_ERROR,ASN1_DER_ERROR: the der encoding doesn't match
 
150
the structure ELEMENT.
 
151
@end deftypefun
 
152
 
 
153
@deftypefun {asn1_retCode} {asn1_expand_any_defined_by} (ASN1_TYPE @var{definitions}, ASN1_TYPE * @var{element})
 
154
@var{definitions}: ASN1 definitions
 
155
 
 
156
@var{element}: pointer to an ASN1 structure
 
157
 
 
158
Expands every "ANY DEFINED BY" element of a structure created from
 
159
a DER decoding process (asn1_der_decoding function). The element ANY
 
160
must be defined by an OBJECT IDENTIFIER. The type used to expand
 
161
the element ANY is the first one following the definition of
 
162
the actual value of the OBJECT IDENTIFIER.
 
163
 
 
164
@strong{Returns:} 
 
165
@strong{ASN1_SUCCESS:} Substitution OK.
 
166
 
 
167
@strong{ASN1_ERROR_TYPE_ANY:} Some "ANY DEFINED BY" element couldn't be
 
168
expanded due to a problem in OBJECT_ID -> TYPE association.
 
169
 
 
170
other errors: Result of der decoding process.
 
171
@end deftypefun
 
172
 
 
173
@deftypefun {asn1_retCode} {asn1_expand_octet_string} (ASN1_TYPE @var{definitions}, ASN1_TYPE * @var{element}, const char * @var{octetName}, const char * @var{objectName})
 
174
@var{definitions}: ASN1 definitions
 
175
 
 
176
@var{element}: pointer to an ASN1 structure
 
177
 
 
178
@var{octetName}: name of the OCTECT STRING field to expand.
 
179
 
 
180
@var{objectName}: name of the OBJECT IDENTIFIER field to use to define
 
181
the type for expansion.
 
182
 
 
183
Expands an "OCTET STRING" element of a structure created from a
 
184
DER decoding process (asn1_der_decoding function). The type used
 
185
for expansion is the first one following the definition of the
 
186
actual value of the OBJECT IDENTIFIER indicated by OBJECTNAME.
 
187
 
 
188
@strong{Returns:} 
 
189
@strong{ASN1_SUCCESS:} Substitution OK.
 
190
 
 
191
@strong{ASN1_ELEMENT_NOT_FOUND:} OBJECTNAME or OCTETNAME are not correct.
 
192
 
 
193
@strong{ASN1_VALUE_NOT_VALID:} Wasn't possible to find the type to use
 
194
for expansion.
 
195
 
 
196
other errors: result of der decoding process.
 
197
@end deftypefun
 
198