1 \input texinfo @c -*-texinfo-*-
3 @comment %**start of header
4 @setfilename libtasn1.info
6 @settitle Libtasn1 @value{VERSION}
8 @c Unify some of the indices.
12 @comment %**end of header
14 This manual is for Libtasn1
15 (version @value{VERSION}, @value{UPDATED}),
16 which is a library for Abstract Syntax Notation One (ASN.1) and
17 Distinguish Encoding Rules (DER) manipulation.
19 Copyright @copyright{} 2004, 2006 Free Software Foundation
21 Copyright @copyright{} 2001, 2002, 2003 Fabio Fiorina
24 Permission is granted to copy, distribute and/or modify this document
25 under the terms of the GNU Free Documentation License, Version 1.1 or
26 any later version published by the Free Software Foundation; with no
27 Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
28 and with the Back-Cover Texts as in (a) below. A copy of the
29 license is included in the section entitled ``GNU Free Documentation
32 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
33 this GNU Manual, like GNU software. Copies published by the Free
34 Software Foundation raise funds for GNU development.''
38 @dircategory GNU Libraries
40 * libtasn1: (libtasn1). Library for Abstract Syntax Notation One (ASN.1).
45 @subtitle Abstract Syntax Notation One (ASN.1) library for the GNU system
46 @subtitle part of the GnuTLS project
47 @subtitle for version @value{VERSION}, @value{UPDATED}
49 @author Simon Josefsson (@email{bug-gnutls@@gnu.org})
51 @vskip 0pt plus 1filll
65 * ASN.1 structure handling::
67 * Function reference::
68 * Copying This Manual::
72 * Concept Index:: Index of concepts and programs.
73 * Function and Data Index:: Index of functions, variables and data types.
77 @node ASN.1 structure handling
78 @chapter ASN.1 structure handling
80 This document describes the Libtasn1 library developed for ASN.1
81 (Abstract Syntax Notation One) structures management.
83 The main features of this library are:
87 @item On line ASN1 structure management that doesn't require any
88 C code file generation.
90 @item Off line ASN1 structure management with C code file generation
93 @item DER (Distinguish Encoding Rules) encoding.
95 @item No limits for INTEGER and ENUMERATED values.
97 @item It's Free Software.
98 Anybody can use, modify, and redistribute the library under the terms
99 of the GNU Lesser General Public License.
101 @item It's thread-safe.
103 No global variables are used and multiple library handles and session
104 handles may be used in parallel.
108 It should work on all Unix like operating systems, including Windows.
109 The library itself should be portable to any C89 system, not even
117 * Future developments::
121 @section ASN.1 syntax
125 The parser is case sensitive. The comments begin with "-- " and end at
126 the end of lines. An example is in "pkix.asn" file. ASN.1
127 definitions must have this syntax:
130 definitions_name {<object definition>}
132 DEFINITIONS <EXPLICIT or IMPLICIT> TAGS ::=
136 <type and constants definitions>
141 The token "::=" must be separate from others elements, so this is a
155 Here is the list of types that the parser can manage:
157 @cindex Supported ASN.1 types, list of
164 @item OBJECT IDENTIFIER
169 @item GeneralizedTime
181 This version doesn't manage REAL type. It doesn't allow the "EXPORT"
182 and "IMPORT" sections too.
184 The SIZE constraints are allowed, but no check is done on them.
189 Consider this definition:
194 DEFINITIONS EXPLICIT TAGS ::=
199 id OBJECT IDENTIFIER,
211 To identify the type 'Group' you have to use the null terminated
212 string "Example.Group". These strings are used in functions that are
217 Field 'id' in 'Group' type : "Example.Group.id".
219 Field 'value1' in field 'value' in type 'Group':
220 "Example.Group.value.value1".
222 Elements of structured types that don't have a name, receive the name
223 "?1","?2", and so on.
225 The name "?LAST" indicates the last element of a @code{SET_OF} or
229 @section Library Notes
231 @cindex Header file libtasn1.h
233 The header file of this library is @file{libtasn1.h}.
235 @cindex Main type ASN1_TYPE
237 The main type used in it is @code{ASN1_TYPE}, and it's used to store
238 the @acronym{ASN.1} definitions and structures (instances).
240 The constant @acronym{ASN1_TYPE_EMPTY} can be used for the variable
241 initialization. For example:
244 ASN1_TYPE definitions=ASN1_TYPE_EMPTY;
247 Some functions require a parameter named errorDescription of char*
248 type. The array must be already allocated and must have at least
249 @code{MAX_ERROR_DESCRIPTION_SIZE} bytes (E.g, as in @code{char
250 Description[MAX_ERROR_DESCRIPTION_SIZE];}).
252 @code{MAX_NAME_SIZE} indicates the maximum number of characters of a
253 name inside a file with ASN1 definitions.
255 @node Future developments
256 @section Future developments
257 @cindex Future developments
261 @item Add functions for a C code file generation containing equivalent
262 data structures (not a single array like now).
272 * Invoking asn1Parser::
273 * Invoking asn1Coding::
274 * Invoking asn1Decoding::
277 @node Invoking asn1Parser
278 @section Invoking asn1Parser
279 @cindex asn1Parser program
281 @file{asn1Parser} reads one file with ASN1 definitions and generates a
282 file with an array to use with libtasn1 functions.
285 Usage: asn1Parser [options] file
288 -h : shows the help message.
289 -v : shows version information and exit.
290 -c : checks the syntax only.
291 -o file : output file.
292 -n name : array name.
295 @node Invoking asn1Coding
296 @section Invoking asn1Coding
297 @cindex asn1Coding program
299 @file{asn1Coding} generates a DER encoding from a file with ASN1
300 definitions and another one with assignments.
302 The file with assignments must have this syntax:
305 InstanceName Asn1Definition
313 The output file is a binary file with the DER encoding.
316 Usage: asn1Coding [options] file1 file2
317 file1 : file with ASN1 definitions.
318 file2 : file with assignments.
320 -h : shows the help message.
321 -v : shows version information and exit.
322 -c : checks the syntax only.
323 -o file : output file.
326 @node Invoking asn1Decoding
327 @section Invoking asn1Decoding
328 @cindex asn1Decoding program
330 @file{asn1Decoding} generates an ASN1 structure from a file with ASN1
331 definitions and a binary file with a DER encoding.
334 Usage: asn1Decoding [options] file1 file2 type
335 file1 : file with ASN1 definitions.
336 file2 : binary file with a DER encoding.
337 type : ASN1 definition name.
339 -h : shows the help message.
340 -v : shows version information and exit.
341 -c : checks the syntax only.
342 -o file : output file.
345 @node Function reference
346 @chapter Function reference
349 * ASN.1 schema functions::
350 * ASN.1 field functions::
352 * Error handling functions::
353 * Auxilliary functions::
356 @node ASN.1 schema functions
357 @section ASN.1 schema functions
359 @include texi/ASN1.c.texi
361 @node ASN.1 field functions
362 @section ASN.1 field functions
364 @include texi/structure.c.texi
365 @include texi/element.c.texi
368 @section DER functions
370 @include texi/coding.c.texi
371 @include texi/decoding.c.texi
373 @node Error handling functions
374 @section Error handling functions
376 @include texi/errors.c.texi
378 @node Auxilliary functions
379 @section Auxilliary functions
381 @include texi/parser_aux.c.texi
383 @node Copying This Manual
384 @appendix Copying This Manual
387 * GNU Free Documentation License:: License for copying this manual.
394 @unnumbered Concept Index
398 @node Function and Data Index
399 @unnumbered Function and Data Index