3
<title>GNU Libtasn1 2.7</title>
3
<title>GNU Libtasn1 2.9</title>
4
4
<meta http-equiv="Content-Type" content="text/html">
5
<meta name="description" content="GNU Libtasn1 2.7">
5
<meta name="description" content="GNU Libtasn1 2.9">
6
6
<meta name="generator" content="makeinfo 4.13">
7
7
<link title="Top" rel="top" href="#Top">
8
8
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
10
10
This manual is for GNU Libtasn1
11
(version 2.7, 20 April 2010),
11
(version 2.9, 30 September 2010),
12
12
which is a library for Abstract Syntax Notation One (ASN.1) and
13
13
Distinguish Encoding Rules (DER) manipulation.
128
128
<h2 class="unnumbered">Libtasn1</h2>
130
130
<p>This manual is for GNU Libtasn1
131
(version 2.7, 20 April 2010),
131
(version 2.9, 30 September 2010),
132
132
which is a library for Abstract Syntax Notation One (ASN.1) and
133
133
Distinguish Encoding Rules (DER) manipulation.
538
538
<p>Function used to start the parse algorithm. Creates the structures
539
539
needed to manage the definitions included in <code>file_name</code> file.
541
<p><strong>Returns:</strong> </p></blockquote></div>
541
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if the file has a correct syntax and every
542
identifier is known, <code>ASN1_ELEMENT_NOT_EMPTY</code> if <code>definitions</code> not
543
<code>ASN1_TYPE_EMPTY</code>, <code>ASN1_FILE_NOT_FOUND</code> if an error occured while
544
opening <code>file_name</code>, <code>ASN1_SYNTAX_ERROR</code> if the syntax is not
545
correct, <code>ASN1_IDENTIFIER_NOT_FOUND</code> if in the file there is an
546
identifier that is not defined, <code>ASN1_NAME_TOO_LONG</code> if in the
547
file there is an identifier whith more than <code>ASN1_MAX_NAME_SIZE</code>
549
</p></blockquote></div>
543
551
<h4 class="subheading">asn1_parser2array</h4>
564
572
"/aa/bb/xx_asn1_tab.c". If <code>vectorName</code> is <code>NULL</code> the vector name
565
573
will be "xx_asn1_tab".
567
<p><strong>Returns:</strong> </p></blockquote></div>
575
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if the file has a correct syntax and every
576
identifier is known, <code>ASN1_FILE_NOT_FOUND</code> if an error occured
577
while opening <code>inputFileName</code>, <code>ASN1_SYNTAX_ERROR</code> if the syntax is
578
not correct, <code>ASN1_IDENTIFIER_NOT_FOUND</code> if in the file there is
579
an identifier that is not defined, <code>ASN1_NAME_TOO_LONG</code> if in the
580
file there is an identifier whith more than <code>ASN1_MAX_NAME_SIZE</code>
582
</p></blockquote></div>
569
584
<div class="node">
570
585
<a name="ASN.1-field-functions"></a>
594
609
<p>Creates the structures needed to manage the ASN.1 definitions.
595
610
<code>array</code> is a vector created by <code>asn1_parser2array()</code>.
597
<p><strong>Returns:</strong> </p></blockquote></div>
612
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if structure was created correctly,
613
<code>ASN1_ELEMENT_NOT_EMPTY</code> if *<code>definitions</code> not ASN1_TYPE_EMPTY,
614
<code>ASN1_IDENTIFIER_NOT_FOUND</code> if in the file there is an identifier
615
that is not defined (see <code>errorDescription</code> for more information),
616
<code>ASN1_ARRAY_ERROR</code> if the array pointed by <code>array</code> is wrong.
617
</p></blockquote></div>
599
619
<h4 class="subheading">asn1_delete_structure</h4>
607
627
<p>Deletes the structure *<code>structure</code>. At the end, *<code>structure</code> is set
608
628
to ASN1_TYPE_EMPTY.
610
<p><strong>Returns:</strong> </p></blockquote></div>
630
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if successful, <code>ASN1_ELEMENT_NOT_FOUND</code> if
631
*<code>structure</code> was ASN1_TYPE_EMPTY.
632
</p></blockquote></div>
612
634
<h4 class="subheading">asn1_delete_element</h4>
623
645
<p>Deletes the element named *<code>element_name</code> inside *<code>structure</code>.
625
<p><strong>Returns:</strong> </p></blockquote></div>
647
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if successful, <code>ASN1_ELEMENT_NOT_FOUND</code> if
648
the <code>element_name</code> was not found.
649
</p></blockquote></div>
627
651
<h4 class="subheading">asn1_create_element</h4>
643
667
<p>rc = asn1_create_element(cert_def, "PKIX1.Certificate", certptr);
645
<p><strong>Returns:</strong> </p></blockquote></div>
669
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if creation OK, <code>ASN1_ELEMENT_NOT_FOUND</code> if
670
<code>source_name</code> is not known.
671
</p></blockquote></div>
647
673
<h4 class="subheading">asn1_print_structure</h4>
679
705
<p>Counts the number of elements of a sub-structure called NAME with
680
706
names equal to "?1","?2", ...
682
<p><strong>Returns:</strong> </p></blockquote></div>
708
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if successful, <code>ASN1_ELEMENT_NOT_FOUND</code> if
709
<code>name</code> is not known, <code>ASN1_GENERIC_ERROR</code> if pointer <code>num</code> is <code>NULL</code>.
710
</p></blockquote></div>
684
712
<h4 class="subheading">asn1_find_structure_from_oid</h4>
715
743
<p>Create a deep copy of a ASN1_TYPE variable.
717
<p><strong>Return value:</strong> Return <code>ASN1_SUCCESS</code> on success.
745
<p><strong>Returns:</strong> Return <code>ASN1_SUCCESS</code> on success.
718
746
</p></blockquote></div>
720
748
<h4 class="subheading">asn1_write_value</h4>
825
853
<p>result=asn1_write_value(cert,
826
854
"tbsCertificate.subject.rdnSequence.?LAST", "NEW", 1);
828
<p><strong>Returns:</strong> </p></blockquote></div>
856
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if the value was set,
857
<code>ASN1_ELEMENT_NOT_FOUND</code> if <code>name</code> is not a valid element, and
858
<code>ASN1_VALUE_NOT_VALID</code> if <code>ivalue</code> has a wrong format.
859
</p></blockquote></div>
830
861
<h4 class="subheading">asn1_read_value</h4>
888
919
<p><strong>ANY:</strong> If NAME indicates an any type, VALUE will indicate the DER
889
920
encoding of the structure actually used.
891
<p><strong>Returns:</strong> </p></blockquote></div>
922
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if value is returned,
923
<code>ASN1_ELEMENT_NOT_FOUND</code> if <code>name</code> is not a valid element,
924
<code>ASN1_VALUE_NOT_FOUND</code> if there isn't any value for the element
925
selected, and <code>ASN1_MEM_ERROR</code> if The value vector isn't big enough
926
to store the result, and in this case <code>len</code> will contain the number of
928
</p></blockquote></div>
893
930
<h4 class="subheading">asn1_read_tag</h4>
910
947
<code>ASN1_CLASS_UNIVERSAL</code>, <code>ASN1_CLASS_PRIVATE</code> or
911
948
<code>ASN1_CLASS_CONTEXT_SPECIFIC</code>.
913
<p><strong>Returns:</strong> </p></blockquote></div>
950
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if successful, <code>ASN1_ELEMENT_NOT_FOUND</code> if
951
<code>name</code> is not a valid element.
952
</p></blockquote></div>
915
954
<div class="node">
916
955
<a name="DER-functions"></a>
995
1034
<p>Creates the DER encoding for the NAME structure (inside *POINTER
998
<p><strong>Returns:</strong> </p></blockquote></div>
1037
<p><strong>Returns:</strong> <code>ASN1_SUCCESS</code> if DER encoding OK, <code>ASN1_ELEMENT_NOT_FOUND</code>
1038
if <code>name</code> is not a valid element, <code>ASN1_VALUE_NOT_FOUND</code> if there
1039
is an element without a value, <code>ASN1_MEM_ERROR</code> if the <code>ider</code>
1040
vector isn't big enough and in this case <code>len</code> will contain the
1042
</p></blockquote></div>
1000
1044
<h4 class="subheading">asn1_get_length_der</h4>
1487
1531
of text. A copy that is not “Transparent” is called “Opaque”.
1489
1533
<p>Examples of suitable formats for Transparent copies include plain
1490
<span class="sc">ascii</span> without markup, Texinfo input format, LaTeX input
1491
format, <acronym>SGML</acronym> or <acronym>XML</acronym> using a publicly available
1492
<acronym>DTD</acronym>, and standard-conforming simple <acronym>HTML</acronym>,
1493
PostScript or <acronym>PDF</acronym> designed for human modification. Examples
1494
of transparent image formats include <acronym>PNG</acronym>, <acronym>XCF</acronym> and
1495
<acronym>JPG</acronym>. Opaque formats include proprietary formats that can be
1496
read and edited only by proprietary word processors, <acronym>SGML</acronym> or
1497
<acronym>XML</acronym> for which the <acronym>DTD</acronym> and/or processing tools are
1498
not generally available, and the machine-generated <acronym>HTML</acronym>,
1499
PostScript or <acronym>PDF</acronym> produced by some word processors for
1534
ASCII without markup, Texinfo input format, LaTeX input
1535
format, SGML or XML using a publicly available
1536
DTD, and standard-conforming simple HTML,
1537
PostScript or PDF designed for human modification. Examples
1538
of transparent image formats include PNG, XCF and
1539
JPG. Opaque formats include proprietary formats that can be
1540
read and edited only by proprietary word processors, SGML or
1541
XML for which the DTD and/or processing tools are
1542
not generally available, and the machine-generated HTML,
1543
PostScript or PDF produced by some word processors for
1500
1544
output purposes only.
1502
1546
<p>The “Title Page” means, for a printed book, the title page itself,