Sync usage with man page.
[netbsd-mini2440.git] / crypto / external / bsd / openssl / lib / libcrypto / man / ASN1_generate_nconf.3
blobbf33ddd0d58a0b1423d8b6e1b726eb9b7f63fe70
1 .\"     $NetBSD: libcrypto.pl,v 1.3 2007/11/27 22:16:03 christos Exp $
2 .\"
3 .\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
4 .\"
5 .\" Standard preamble:
6 .\" ========================================================================
7 .de Sh \" Subsection heading
8 .br
9 .if t .Sp
10 .ne 5
11 .PP
12 \fB\\$1\fR
13 .PP
15 .de Sp \" Vertical space (when we can't use .PP)
16 .if t .sp .5v
17 .if n .sp
19 .de Vb \" Begin verbatim text
20 .ft CW
21 .nf
22 .ne \\$1
24 .de Ve \" End verbatim text
25 .ft R
26 .fi
28 .\" Set up some character translations and predefined strings.  \*(-- will
29 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
30 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
31 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
32 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
33 .\" nothing in troff, for use with C<>.
34 .tr \(*W-
35 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
36 .ie n \{\
37 .    ds -- \(*W-
38 .    ds PI pi
39 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
40 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
41 .    ds L" ""
42 .    ds R" ""
43 .    ds C` ""
44 .    ds C' ""
45 'br\}
46 .el\{\
47 .    ds -- \|\(em\|
48 .    ds PI \(*p
49 .    ds L" ``
50 .    ds R" ''
51 'br\}
52 .\"
53 .\" Escape single quotes in literal strings from groff's Unicode transform.
54 .ie \n(.g .ds Aq \(aq
55 .el       .ds Aq '
56 .\"
57 .\" If the F register is turned on, we'll generate index entries on stderr for
58 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
59 .\" entries marked with X<> in POD.  Of course, you'll have to process the
60 .\" output yourself in some meaningful fashion.
61 .ie \nF \{\
62 .    de IX
63 .    tm Index:\\$1\t\\n%\t"\\$2"
65 .    nr % 0
66 .    rr F
67 .\}
68 .el \{\
69 .    de IX
71 .\}
72 .\"
73 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
74 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
75 .    \" fudge factors for nroff and troff
76 .if n \{\
77 .    ds #H 0
78 .    ds #V .8m
79 .    ds #F .3m
80 .    ds #[ \f1
81 .    ds #] \fP
82 .\}
83 .if t \{\
84 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
85 .    ds #V .6m
86 .    ds #F 0
87 .    ds #[ \&
88 .    ds #] \&
89 .\}
90 .    \" simple accents for nroff and troff
91 .if n \{\
92 .    ds ' \&
93 .    ds ` \&
94 .    ds ^ \&
95 .    ds , \&
96 .    ds ~ ~
97 .    ds /
98 .\}
99 .if t \{\
100 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
101 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
102 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
103 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
104 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
105 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
107 .    \" troff and (daisy-wheel) nroff accents
108 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
109 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
110 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
111 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
112 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
113 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
114 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
115 .ds ae a\h'-(\w'a'u*4/10)'e
116 .ds Ae A\h'-(\w'A'u*4/10)'E
117 .    \" corrections for vroff
118 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
119 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
120 .    \" for low resolution devices (crt and lpr)
121 .if \n(.H>23 .if \n(.V>19 \
123 .    ds : e
124 .    ds 8 ss
125 .    ds o a
126 .    ds d- d\h'-1'\(ga
127 .    ds D- D\h'-1'\(hy
128 .    ds th \o'bp'
129 .    ds Th \o'LP'
130 .    ds ae ae
131 .    ds Ae AE
133 .rm #[ #] #H #V #F C
134 .\" ========================================================================
136 .IX Title "ASN1_generate_nconf 3"
137 .TH ASN1_generate_nconf 3 "2008-01-23" "1.1.0-dev" "OpenSSL"
138 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
139 .\" way too many mistakes in technical documents.
140 .if n .ad l
142 .SH "NAME"
143 ASN1_generate_nconf, ASN1_generate_v3 \- ASN1 generation functions
144 .SH "LIBRARY"
145 libcrypto, -lcrypto
146 .SH "SYNOPSIS"
147 .IX Header "SYNOPSIS"
148 .Vb 1
149 \& #include <openssl/asn1.h>
151 \& ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
152 \& ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
154 .SH "DESCRIPTION"
155 .IX Header "DESCRIPTION"
156 These functions generate the \s-1ASN1\s0 encoding of a string
157 in an \fB\s-1ASN1_TYPE\s0\fR structure.
159 \&\fBstr\fR contains the string to encode \fBnconf\fR or \fBcnf\fR contains
160 the optional configuration information where additional strings
161 will be read from. \fBnconf\fR will typically come from a config
162 file wherease \fBcnf\fR is obtained from an \fBX509V3_CTX\fR structure
163 which will typically be used by X509 v3 certificate extension
164 functions. \fBcnf\fR or \fBnconf\fR can be set to \fB\s-1NULL\s0\fR if no additional
165 configuration will be used.
166 .SH "GENERATION STRING FORMAT"
167 .IX Header "GENERATION STRING FORMAT"
168 The actual data encoded is determined by the string \fBstr\fR and
169 the configuration information. The general format of the string
171 .IP "\fB[modifier,]type[:value]\fR" 2
172 .IX Item "[modifier,]type[:value]"
174 That is zero or more comma separated modifiers followed by a type
175 followed by an optional colon and a value. The formats of \fBtype\fR,
176 \&\fBvalue\fR and \fBmodifier\fR are explained below.
177 .Sh "\s-1SUPPORTED\s0 \s-1TYPES\s0"
178 .IX Subsection "SUPPORTED TYPES"
179 The supported types are listed below. Unless otherwise specified
180 only the \fB\s-1ASCII\s0\fR format is permissible.
181 .IP "\fB\s-1BOOLEAN\s0\fR, \fB\s-1BOOL\s0\fR" 2
182 .IX Item "BOOLEAN, BOOL"
183 This encodes a boolean type. The \fBvalue\fR string is mandatory and
184 should be \fB\s-1TRUE\s0\fR or \fB\s-1FALSE\s0\fR. Additionally \fB\s-1TRUE\s0\fR, \fBtrue\fR, \fBY\fR,
185 \&\fBy\fR, \fB\s-1YES\s0\fR, \fByes\fR, \fB\s-1FALSE\s0\fR, \fBfalse\fR, \fBN\fR, \fBn\fR, \fB\s-1NO\s0\fR and \fBno\fR
186 are acceptable.
187 .IP "\fB\s-1NULL\s0\fR" 2
188 .IX Item "NULL"
189 Encode the \fB\s-1NULL\s0\fR type, the \fBvalue\fR string must not be present.
190 .IP "\fB\s-1INTEGER\s0\fR, \fB\s-1INT\s0\fR" 2
191 .IX Item "INTEGER, INT"
192 Encodes an \s-1ASN1\s0 \fB\s-1INTEGER\s0\fR type. The \fBvalue\fR string represents
193 the value of the integer, it can be preceeded by a minus sign and
194 is normally interpreted as a decimal value unless the prefix \fB0x\fR
195 is included.
196 .IP "\fB\s-1ENUMERATED\s0\fR, \fB\s-1ENUM\s0\fR" 2
197 .IX Item "ENUMERATED, ENUM"
198 Encodes the \s-1ASN1\s0 \fB\s-1ENUMERATED\s0\fR type, it is otherwise identical to
199 \&\fB\s-1INTEGER\s0\fR.
200 .IP "\fB\s-1OBJECT\s0\fR, \fB\s-1OID\s0\fR" 2
201 .IX Item "OBJECT, OID"
202 Encodes an \s-1ASN1\s0 \fB\s-1OBJECT\s0 \s-1IDENTIFIER\s0\fR, the \fBvalue\fR string can be
203 a short name, a long name or numerical format.
204 .IP "\fB\s-1UTCTIME\s0\fR, \fB\s-1UTC\s0\fR" 2
205 .IX Item "UTCTIME, UTC"
206 Encodes an \s-1ASN1\s0 \fBUTCTime\fR structure, the value should be in
207 the format \fB\s-1YYMMDDHHMMSSZ\s0\fR.
208 .IP "\fB\s-1GENERALIZEDTIME\s0\fR, \fB\s-1GENTIME\s0\fR" 2
209 .IX Item "GENERALIZEDTIME, GENTIME"
210 Encodes an \s-1ASN1\s0 \fBGeneralizedTime\fR structure, the value should be in
211 the format \fB\s-1YYYYMMDDHHMMSSZ\s0\fR.
212 .IP "\fB\s-1OCTETSTRING\s0\fR, \fB\s-1OCT\s0\fR" 2
213 .IX Item "OCTETSTRING, OCT"
214 Encodes an \s-1ASN1\s0 \fB\s-1OCTET\s0 \s-1STRING\s0\fR. \fBvalue\fR represents the contents
215 of this structure, the format strings \fB\s-1ASCII\s0\fR and \fB\s-1HEX\s0\fR can be
216 used to specify the format of \fBvalue\fR.
217 .IP "\fB\s-1BITSTRING\s0\fR, \fB\s-1BITSTR\s0\fR" 2
218 .IX Item "BITSTRING, BITSTR"
219 Encodes an \s-1ASN1\s0 \fB\s-1BIT\s0 \s-1STRING\s0\fR. \fBvalue\fR represents the contents
220 of this structure, the format strings \fB\s-1ASCII\s0\fR, \fB\s-1HEX\s0\fR and \fB\s-1BITLIST\s0\fR
221 can be used to specify the format of \fBvalue\fR.
223 If the format is anything other than \fB\s-1BITLIST\s0\fR the number of unused
224 bits is set to zero.
225 .IP "\fB\s-1UNIVERSALSTRING\s0\fR, \fB\s-1UNIV\s0\fR, \fB\s-1IA5\s0\fR, \fB\s-1IA5STRING\s0\fR, \fB\s-1UTF8\s0\fR, \fBUTF8String\fR, \fB\s-1BMP\s0\fR, \fB\s-1BMPSTRING\s0\fR, \fB\s-1VISIBLESTRING\s0\fR, \fB\s-1VISIBLE\s0\fR, \fB\s-1PRINTABLESTRING\s0\fR, \fB\s-1PRINTABLE\s0\fR, \fBT61\fR, \fBT61STRING\fR, \fB\s-1TELETEXSTRING\s0\fR, \fBGeneralString\fR, \fB\s-1NUMERICSTRING\s0\fR, \fB\s-1NUMERIC\s0\fR" 2
226 .IX Item "UNIVERSALSTRING, UNIV, IA5, IA5STRING, UTF8, UTF8String, BMP, BMPSTRING, VISIBLESTRING, VISIBLE, PRINTABLESTRING, PRINTABLE, T61, T61STRING, TELETEXSTRING, GeneralString, NUMERICSTRING, NUMERIC"
227 These encode the corresponding string types. \fBvalue\fR represents the
228 contents of this structure. The format can be \fB\s-1ASCII\s0\fR or \fB\s-1UTF8\s0\fR.
229 .IP "\fB\s-1SEQUENCE\s0\fR, \fB\s-1SEQ\s0\fR, \fB\s-1SET\s0\fR" 2
230 .IX Item "SEQUENCE, SEQ, SET"
231 Formats the result as an \s-1ASN1\s0 \fB\s-1SEQUENCE\s0\fR or \fB\s-1SET\s0\fR type. \fBvalue\fR
232 should be a section name which will contain the contents. The
233 field names in the section are ignored and the values are in the
234 generated string format. If \fBvalue\fR is absent then an empty \s-1SEQUENCE\s0
235 will be encoded.
236 .Sh "\s-1MODIFIERS\s0"
237 .IX Subsection "MODIFIERS"
238 Modifiers affect the following structure, they can be used to
239 add \s-1EXPLICIT\s0 or \s-1IMPLICIT\s0 tagging, add wrappers or to change
240 the string format of the final type and value. The supported
241 formats are documented below.
242 .IP "\fB\s-1EXPLICIT\s0\fR, \fB\s-1EXP\s0\fR" 2
243 .IX Item "EXPLICIT, EXP"
244 Add an explicit tag to the following structure. This string
245 should be followed by a colon and the tag value to use as a
246 decimal value.
248 By following the number with \fBU\fR, \fBA\fR, \fBP\fR or \fBC\fR \s-1UNIVERSAL\s0,
249 \&\s-1APPLICATION\s0, \s-1PRIVATE\s0 or \s-1CONTEXT\s0 \s-1SPECIFIC\s0 tagging can be used,
250 the default is \s-1CONTEXT\s0 \s-1SPECIFIC\s0.
251 .IP "\fB\s-1IMPLICIT\s0\fR, \fB\s-1IMP\s0\fR" 2
252 .IX Item "IMPLICIT, IMP"
253 This is the same as \fB\s-1EXPLICIT\s0\fR except \s-1IMPLICIT\s0 tagging is used
254 instead.
255 .IP "\fB\s-1OCTWRAP\s0\fR, \fB\s-1SEQWRAP\s0\fR, \fB\s-1SETWRAP\s0\fR, \fB\s-1BITWRAP\s0\fR" 2
256 .IX Item "OCTWRAP, SEQWRAP, SETWRAP, BITWRAP"
257 The following structure is surrounded by an \s-1OCTET\s0 \s-1STRING\s0, a \s-1SEQUENCE\s0,
258 a \s-1SET\s0 or a \s-1BIT\s0 \s-1STRING\s0 respectively. For a \s-1BIT\s0 \s-1STRING\s0 the number of unused
259 bits is set to zero.
260 .IP "\fB\s-1FORMAT\s0\fR" 2
261 .IX Item "FORMAT"
262 This specifies the format of the ultimate value. It should be followed
263 by a colon and one of the strings \fB\s-1ASCII\s0\fR, \fB\s-1UTF8\s0\fR, \fB\s-1HEX\s0\fR or \fB\s-1BITLIST\s0\fR.
265 If no format specifier is included then \fB\s-1ASCII\s0\fR is used. If \fB\s-1UTF8\s0\fR is
266 specified then the value string must be a valid \fB\s-1UTF8\s0\fR string. For \fB\s-1HEX\s0\fR the
267 output must be a set of hex digits. \fB\s-1BITLIST\s0\fR (which is only valid for a \s-1BIT\s0
268 \&\s-1STRING\s0) is a comma separated list of the indices of the set bits, all other
269 bits are zero.
270 .SH "EXAMPLES"
271 .IX Header "EXAMPLES"
272 A simple IA5String:
274 .Vb 1
275 \& IA5STRING:Hello World
278 An IA5String explicitly tagged:
280 .Vb 1
281 \& EXPLICIT:0,IA5STRING:Hello World
284 An IA5String explicitly tagged using \s-1APPLICATION\s0 tagging:
286 .Vb 1
287 \& EXPLICIT:0A,IA5STRING:Hello World
290 A \s-1BITSTRING\s0 with bits 1 and 5 set and all others zero:
292 .Vb 1
293 \& FORMAT=BITLIST,BITSTRING:1,5
296 A more complex example using a config file to produce a
297 \&\s-1SEQUENCE\s0 consiting of a \s-1BOOL\s0 an \s-1OID\s0 and a UTF8String:
299 .Vb 1
300 \& asn1 = SEQUENCE:seq_section
302 \& [seq_section]
304 \& field1 = BOOLEAN:TRUE
305 \& field2 = OID:commonName
306 \& field3 = UTF8:Third field
309 This example produces an RSAPrivateKey structure, this is the
310 key contained in the file client.pem in all OpenSSL distributions
311 (note: the field names such as 'coeff' are ignored and are present just
312 for clarity):
314 .Vb 3
315 \& asn1=SEQUENCE:private_key
316 \& [private_key]
317 \& version=INTEGER:0
319 \& n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\e
320 \& D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9
322 \& e=INTEGER:0x010001
324 \& d=INTEGER:0x6F05EAD2F27FFAEC84BEC360C4B928FD5F3A9865D0FCAAD291E2A52F4A\e
325 \& F810DC6373278C006A0ABBA27DC8C63BF97F7E666E27C5284D7D3B1FFFE16B7A87B51D
327 \& p=INTEGER:0xF3929B9435608F8A22C208D86795271D54EBDFB09DDEF539AB083DA912\e
328 \& D4BD57
330 \& q=INTEGER:0xC50016F89DFF2561347ED1186A46E150E28BF2D0F539A1594BBD7FE467\e
331 \& 46EC4F
333 \& exp1=INTEGER:0x9E7D4326C924AFC1DEA40B45650134966D6F9DFA3A7F9D698CD4ABEA\e
334 \& 9C0A39B9
336 \& exp2=INTEGER:0xBA84003BB95355AFB7C50DF140C60513D0BA51D637272E355E397779\e
337 \& E7B2458F
339 \& coeff=INTEGER:0x30B9E4F2AFA5AC679F920FC83F1F2DF1BAF1779CF989447FABC2F5\e
340 \& 628657053A
343 This example is the corresponding public key in a SubjectPublicKeyInfo
344 structure:
346 .Vb 2
347 \& # Start with a SEQUENCE
348 \& asn1=SEQUENCE:pubkeyinfo
350 \& # pubkeyinfo contains an algorithm identifier and the public key wrapped
351 \& # in a BIT STRING
352 \& [pubkeyinfo]
353 \& algorithm=SEQUENCE:rsa_alg
354 \& pubkey=BITWRAP,SEQUENCE:rsapubkey
356 \& # algorithm ID for RSA is just an OID and a NULL
357 \& [rsa_alg]
358 \& algorithm=OID:rsaEncryption
359 \& parameter=NULL
361 \& # Actual public key: modulus and exponent
362 \& [rsapubkey]
363 \& n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\e
364 \& D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9
366 \& e=INTEGER:0x010001
368 .SH "RETURN VALUES"
369 .IX Header "RETURN VALUES"
370 \&\fIASN1_generate_nconf()\fR and \fIASN1_generate_v3()\fR return the encoded
371 data as an \fB\s-1ASN1_TYPE\s0\fR structure or \fB\s-1NULL\s0\fR if an error occurred.
373 The error codes that can be obtained by \fIERR_get_error\fR\|(3).
374 .SH "SEE ALSO"
375 .IX Header "SEE ALSO"
376 \&\fIERR_get_error\fR\|(3)
377 .SH "HISTORY"
378 .IX Header "HISTORY"
379 \&\fIASN1_generate_nconf()\fR and \fIASN1_generate_v3()\fR were added to OpenSSL 0.9.8