5 ASN1_generate_nconf, ASN1_generate_v3 - ASN1 generation functions
9 ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
10 ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
14 These functions generate the ASN1 encoding of a string
15 in an B<ASN1_TYPE> structure.
17 B<str> contains the string to encode B<nconf> or B<cnf> contains
18 the optional configuration information where additional strings
19 will be read from. B<nconf> will typically come from a config
20 file wherease B<cnf> is obtained from an B<X509V3_CTX> structure
21 which will typically be used by X509 v3 certificate extension
22 functions. B<cnf> or B<nconf> can be set to B<NULL> if no additional
23 configuration will be used.
25 =head1 GENERATION STRING FORMAT
27 The actual data encoded is determined by the string B<str> and
28 the configuration information. The general format of the string
31 B<[modifier,]type[:value]>
33 That is zero or more comma separated modifiers followed by a type
34 followed by an optional colon and a value. The formats of B<type>,
35 B<value> and B<modifier> is explained below.
37 =head2 SUPPORTED TYPES
41 =item B<BOOLEAN>, B<BOOL>
43 This encodes a boolean type. The B<value> string is mandatory and
44 should be B<TRUE> or B<FALSE>. Additionally B<TRUE>, B<true>, B<Y>,
45 B<y>, B<YES>, B<yes>, B<FALSE> B<false>, B<N>, B<n>, B<NO> and B<no>
50 Encode the B<NULL> type, the B<value> string must not be present.
52 =item B<INTEGER>, B<INT>
54 Encodes an ASN1 B<INTEGER> type. The B<value> string represents
55 the value of the integer, it can be preceeded by a minus sign and
56 is normally interpreted as a decimal value unless the prefix B<0x>
59 =item B<ENUMERATED>, B<ENUM>
61 Encodes the ASN1 B<ENUMERATED> type, it is otherwise identical to
64 =item B<OBJECT>, B<OID>
66 Encodes an ASN1 B<OBJECT IDENTIFIER>, the B<value> string can be
67 a short name, a long name or numerical format.
69 =item B<UTCTIME>, B<UTC>
71 Encodes an ASN1 B<UTCTime> structure, the value should be in
72 the format B<YYMMDDHHMMSSZ>.
74 =item B<GENERALIZETIME>, B<GEN>
76 Encodes an ASN1 B<GeneralizeTime> structure, the value should be in
77 the format B<YYYYMMDDHHMMSSZ>.
79 =item B<OCTETSTRING>, B<OCT>
81 Emcodes an ASN1 B<OCTET STRING>. B<value> represents the contents
82 of this structure, the format strings B<ASCII> and B<HEX> can be
83 used to specify the format of B<value>.
85 =item B<BITSRING>, B<BITSTR>
87 Emcodes an ASN1 B<BIT STRING>. B<value> represents the contents
88 of this structure, the format strings B<ASCII>, B<HEX> and B<BITLIST>
89 can be used to specify the format of B<value>.
91 If the format is anything other than B<BITLIST> the number of unused
94 =item B<UNIVERSALSTRING>, B<UNIV>, B<IA5>, B<IA5STRING>, B<UTF8>,
95 B<UTF8String>, B<BMP>, B<BMPSTRING>, B<VISIBLESTRING>,
96 B<VISIBLE>, B<PRINTABLESTRING>, B<PRINTABLE>, B<T61>,
97 B<T61STRING>, B<TELETEXSTRING>
99 These encode the corresponding string types. B<value> represents the
100 contents of this structure. The format can be B<ASCII> or B<UTF8>.
102 =item B<SEQUENCE>, B<SEQ>, B<SET>
104 Formats the result as an ASN1 B<SEQUENCE> or B<SET> type. B<value>
105 should be a section name which will contain the contents. The
106 field names are ignored and the values are in the generated
107 string format. If B<value> is absent the the content will be empty.
117 ASN1_generate_nconf() and ASN1_generate_v3() return the encoded
118 data as an B<ASN1_TYPE> structure or B<NULL> if an error occurred.
120 The error codes that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
122 X509_free() returns no value.
126 L<ERR_get_error(3)|ERR_get_error(3)>, L<d2i_X509(3)|d2i_X509(3)>
130 ASN1_generate_nconf() and ASN1_generate_v3() were added to OpenSSL 0.9.8