summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_new.33
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3369
3 files changed, 373 insertions, 2 deletions
diff --git a/src/lib/libcrypto/man/ASN1_STRING_new.3 b/src/lib/libcrypto/man/ASN1_STRING_new.3
index 65be8c471b..df5f499423 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_new.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_new.3,v 1.8 2017/01/05 08:24:38 jmc Exp $ 1.\" $OpenBSD: ASN1_STRING_new.3,v 1.9 2017/01/05 22:38:04 schwarze Exp $
2.\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400 2.\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400
3.\" 3.\"
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> 4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -204,6 +204,7 @@ if an error occurs.
204.Sh SEE ALSO 204.Sh SEE ALSO
205.Xr ASN1_time_parse 3 , 205.Xr ASN1_time_parse 3 ,
206.Xr ASN1_TIME_set 3 , 206.Xr ASN1_TIME_set 3 ,
207.Xr d2i_ASN1_OCTET_STRING 3 ,
207.Xr ERR_get_error 3 208.Xr ERR_get_error 3
208.Sh BUGS 209.Sh BUGS
209.Vt ASN1_OCTET_STRING , 210.Vt ASN1_OCTET_STRING ,
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 0654dde9c0..42ec3807a2 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.110 2017/01/04 21:14:26 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.111 2017/01/05 22:38:04 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -229,6 +229,7 @@ MAN= \
229 crypto.3 \ 229 crypto.3 \
230 d2i_ASN1_NULL.3 \ 230 d2i_ASN1_NULL.3 \
231 d2i_ASN1_OBJECT.3 \ 231 d2i_ASN1_OBJECT.3 \
232 d2i_ASN1_OCTET_STRING.3 \
232 d2i_ASN1_SEQUENCE_ANY.3 \ 233 d2i_ASN1_SEQUENCE_ANY.3 \
233 d2i_AUTHORITY_KEYID.3 \ 234 d2i_AUTHORITY_KEYID.3 \
234 d2i_BASIC_CONSTRAINTS.3 \ 235 d2i_BASIC_CONSTRAINTS.3 \
diff --git a/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3 b/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3
new file mode 100644
index 0000000000..4ea67412d9
--- /dev/null
+++ b/src/lib/libcrypto/man/d2i_ASN1_OCTET_STRING.3
@@ -0,0 +1,369 @@
1.\" $OpenBSD: d2i_ASN1_OCTET_STRING.3,v 1.1 2017/01/05 22:38:04 schwarze Exp $
2.\"
3.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: January 5 2017 $
18.Dt D2I_ASN1_OCTET_STRING 3
19.Os
20.Sh NAME
21.Nm d2i_ASN1_OCTET_STRING ,
22.Nm i2d_ASN1_OCTET_STRING ,
23.Nm d2i_ASN1_BIT_STRING ,
24.Nm i2d_ASN1_BIT_STRING ,
25.Nm d2i_ASN1_INTEGER ,
26.Nm i2d_ASN1_INTEGER ,
27.Nm d2i_ASN1_ENUMERATED ,
28.Nm i2d_ASN1_ENUMERATED ,
29.Nm d2i_ASN1_UTF8STRING ,
30.Nm i2d_ASN1_UTF8STRING ,
31.Nm d2i_ASN1_IA5STRING ,
32.Nm i2d_ASN1_IA5STRING ,
33.Nm d2i_ASN1_UNIVERSALSTRING ,
34.Nm i2d_ASN1_UNIVERSALSTRING ,
35.Nm d2i_ASN1_BMPSTRING ,
36.Nm i2d_ASN1_BMPSTRING ,
37.Nm d2i_ASN1_GENERALSTRING ,
38.Nm i2d_ASN1_GENERALSTRING ,
39.Nm d2i_ASN1_T61STRING ,
40.Nm i2d_ASN1_T61STRING ,
41.Nm d2i_ASN1_VISIBLESTRING ,
42.Nm i2d_ASN1_VISIBLESTRING ,
43.Nm d2i_ASN1_PRINTABLESTRING ,
44.Nm i2d_ASN1_PRINTABLESTRING ,
45.Nm d2i_ASN1_PRINTABLE ,
46.Nm i2d_ASN1_PRINTABLE ,
47.Nm d2i_DIRECTORYSTRING ,
48.Nm i2d_DIRECTORYSTRING ,
49.Nm d2i_DISPLAYTEXT ,
50.Nm i2d_DISPLAYTEXT ,
51.Nm d2i_ASN1_GENERALIZEDTIME ,
52.Nm i2d_ASN1_GENERALIZEDTIME ,
53.Nm d2i_ASN1_UTCTIME ,
54.Nm i2d_ASN1_UTCTIME ,
55.Nm d2i_ASN1_TIME_new ,
56.Nm i2d_ASN1_TIME_new
57.Nd decode and encode ASN1_STRING objects
58.Sh SYNOPSIS
59.In openssl/asn1.h
60.Ft ASN1_OCTET_STRING *
61.Fo d2i_ASN1_OCTET_STRING
62.Fa "ASN1_OCTET_STRING **val_out"
63.Fa "const unsigned char **der_in"
64.Fa "long length"
65.Fc
66.Ft int
67.Fo i2d_ASN1_OCTET_STRING
68.Fa "ASN1_OCTET_STRING *val_in"
69.Fa "unsigned char **der_out"
70.Fc
71.Ft ASN1_BIT_STRING *
72.Fo d2i_ASN1_BIT_STRING
73.Fa "ASN1_BIT_STRING **val_out"
74.Fa "const unsigned char **der_in"
75.Fa "long length"
76.Fc
77.Ft int
78.Fo i2d_ASN1_BIT_STRING
79.Fa "ASN1_BIT_STRING *val_in"
80.Fa "unsigned char **der_out"
81.Fc
82.Ft ASN1_INTEGER *
83.Fo d2i_ASN1_INTEGER
84.Fa "ASN1_INTEGER **val_out"
85.Fa "const unsigned char **der_in"
86.Fa "long length"
87.Fc
88.Ft int
89.Fo i2d_ASN1_INTEGER
90.Fa "ASN1_INTEGER *val_in"
91.Fa "unsigned char **der_out"
92.Fc
93.Ft ASN1_ENUMERATED *
94.Fo d2i_ASN1_ENUMERATED
95.Fa "ASN1_ENUMERATED **val_out"
96.Fa "const unsigned char **der_in"
97.Fa "long length"
98.Fc
99.Ft int
100.Fo i2d_ASN1_ENUMERATED
101.Fa "ASN1_ENUMERATED *val_in"
102.Fa "unsigned char **der_out"
103.Fc
104.Ft ASN1_UTF8STRING *
105.Fo d2i_ASN1_UTF8STRING
106.Fa "ASN1_UTF8STRING **val_out"
107.Fa "const unsigned char **der_in"
108.Fa "long length"
109.Fc
110.Ft int
111.Fo i2d_ASN1_UTF8STRING
112.Fa "ASN1_UTF8STRING *val_in"
113.Fa "unsigned char **der_out"
114.Fc
115.Ft ASN1_IA5STRING *
116.Fo d2i_ASN1_IA5STRING
117.Fa "ASN1_IA5STRING **val_out"
118.Fa "const unsigned char **der_in"
119.Fa "long length"
120.Fc
121.Ft int
122.Fo i2d_ASN1_IA5STRING
123.Fa "ASN1_IA5STRING *val_in"
124.Fa "unsigned char **der_out"
125.Fc
126.Ft ASN1_UNIVERSALSTRING *
127.Fo d2i_ASN1_UNIVERSALSTRING
128.Fa "ASN1_UNIVERSALSTRING **val_out"
129.Fa "const unsigned char **der_in"
130.Fa "long length"
131.Fc
132.Ft int
133.Fo i2d_ASN1_UNIVERSALSTRING
134.Fa "ASN1_UNIVERSALSTRING *val_in"
135.Fa "unsigned char **der_out"
136.Fc
137.Ft ASN1_BMPSTRING *
138.Fo d2i_ASN1_BMPSTRING
139.Fa "ASN1_BMPSTRING **val_out"
140.Fa "const unsigned char **der_in"
141.Fa "long length"
142.Fc
143.Ft int
144.Fo i2d_ASN1_BMPSTRING
145.Fa "ASN1_BMPSTRING *val_in"
146.Fa "unsigned char **der_out"
147.Fc
148.Ft ASN1_GENERALSTRING *
149.Fo d2i_ASN1_GENERALSTRING
150.Fa "ASN1_GENERALSTRING **val_out"
151.Fa "const unsigned char **der_in"
152.Fa "long length"
153.Fc
154.Ft int
155.Fo i2d_ASN1_GENERALSTRING
156.Fa "ASN1_GENERALSTRING *val_in"
157.Fa "unsigned char **der_out"
158.Fc
159.Ft ASN1_T61STRING *
160.Fo d2i_ASN1_T61STRING
161.Fa "ASN1_T61STRING **val_out"
162.Fa "const unsigned char **der_in"
163.Fa "long length"
164.Fc
165.Ft int
166.Fo i2d_ASN1_T61STRING
167.Fa "ASN1_T61STRING *val_in"
168.Fa "unsigned char **der_out"
169.Fc
170.Ft ASN1_VISIBLESTRING *
171.Fo d2i_ASN1_VISIBLESTRING
172.Fa "ASN1_VISIBLESTRING **val_out"
173.Fa "const unsigned char **der_in"
174.Fa "long length"
175.Fc
176.Ft int
177.Fo i2d_ASN1_VISIBLESTRING
178.Fa "ASN1_VISIBLESTRING *val_in"
179.Fa "unsigned char **der_out"
180.Fc
181.Ft ASN1_PRINTABLESTRING *
182.Fo d2i_ASN1_PRINTABLESTRING
183.Fa "ASN1_PRINTABLESTRING **val_out"
184.Fa "const unsigned char **der_in"
185.Fa "long length"
186.Fc
187.Ft int
188.Fo i2d_ASN1_PRINTABLESTRING
189.Fa "ASN1_PRINTABLESTRING *val_in"
190.Fa "unsigned char **der_out"
191.Fc
192.Ft ASN1_STRING *
193.Fo d2i_ASN1_PRINTABLE
194.Fa "ASN1_STRING **val_out"
195.Fa "const unsigned char **der_in"
196.Fa "long length"
197.Fc
198.Ft int
199.Fo i2d_ASN1_PRINTABLE
200.Fa "ASN1_STRING *val_in"
201.Fa "unsigned char **der_out"
202.Fc
203.Ft ASN1_STRING *
204.Fo d2i_DIRECTORYSTRING
205.Fa "ASN1_STRING **val_out"
206.Fa "const unsigned char **der_in"
207.Fa "long length"
208.Fc
209.Ft int
210.Fo i2d_DIRECTORYSTRING
211.Fa "ASN1_STRING *val_in"
212.Fa "unsigned char **der_out"
213.Fc
214.Ft ASN1_STRING *
215.Fo d2i_DISPLAYTEXT
216.Fa "ASN1_STRING **val_out"
217.Fa "const unsigned char **der_in"
218.Fa "long length"
219.Fc
220.Ft int
221.Fo i2d_DISPLAYTEXT
222.Fa "ASN1_STRING *val_in"
223.Fa "unsigned char **der_out"
224.Fc
225.Ft ASN1_GENERALIZEDTIME *
226.Fo d2i_ASN1_GENERALIZEDTIME
227.Fa "ASN1_GENERALIZEDTIME **val_out"
228.Fa "const unsigned char **der_in"
229.Fa "long length"
230.Fc
231.Ft int
232.Fo i2d_ASN1_GENERALIZEDTIME
233.Fa "ASN1_GENERALIZEDTIME *val_in"
234.Fa "unsigned char **der_out"
235.Fc
236.Ft ASN1_UTCTIME *
237.Fo d2i_ASN1_UTCTIME
238.Fa "ASN1_UTCTIME **val_out"
239.Fa "const unsigned char **der_in"
240.Fa "long length"
241.Fc
242.Ft int
243.Fo i2d_ASN1_UTCTIME
244.Fa "ASN1_UTCTIME *val_in"
245.Fa "unsigned char **der_out"
246.Fc
247.Ft ASN1_TIME *
248.Fo d2i_ASN1_TIME
249.Fa "ASN1_TIME **val_out"
250.Fa "const unsigned char **der_in"
251.Fa "long length"
252.Fc
253.Ft int
254.Fo i2d_ASN1_TIME
255.Fa "ASN1_TIME *val_in"
256.Fa "unsigned char **der_out"
257.Fc
258.Sh DESCRIPTION
259These functions decode and encode various ASN.1 built-in types
260that can be represented by
261.Vt ASN1_STRING
262objects.
263For details about the semantics, examples, caveats, and bugs, see
264.Xr ASN1_item_d2i 3 .
265.Pp
266The format consists of one identifier octet,
267one or more length octets,
268and one or more content octets.
269The identifier octets and corresponding ASN.1 types are as follows:
270.Bl -column ASN1_GENERALIZEDTIME identifier
271.It Em OpenSSL type Ta Em identifier Ta Em ASN.1 type
272.It Ta
273.It Vt ASN1_OCTET_STRING Ta 0x04 Ta OCTET STRING
274.It Vt ASN1_BIT_STRING Ta 0x03 Ta BIT STRING
275.It Vt ASN1_INTEGER Ta 0x02 Ta INTEGER
276.It Vt ASN1_ENUMERATED Ta 0x0a Ta ENUMERATED
277.It Vt ASN1_UTF8STRING Ta 0x0c Ta UTF8String
278.It Vt ASN1_IA5STRING Ta 0x16 Ta IA5String
279.It Vt ASN1_UNIVERSALSTRING Ta 0x1c Ta UniversalString
280.It Vt ASN1_BMPSTRING Ta 0x1e Ta BMPString
281.It Vt ASN1_GENERALSTRING Ta 0x1b Ta GeneralString
282.It Vt ASN1_T61STRING Ta 0x14 Ta T61String
283.It Vt ASN1_VISIBLESTRING Ta 0x1a Ta VisibleString
284.It Vt ASN1_PRINTABLESTRING Ta 0x13 Ta PrintableString
285.It Vt ASN1_GENERALIZEDTIME Ta 0x18 Ta GeneralizedTime
286.It Vt ASN1_UTCTIME Ta 0x17 Ta UTCTime
287.El
288.Pp
289.Fn d2i_DIRECTORYSTRING
290and
291.Fn i2d_DIRECTORYSTRING
292decode and encode an ASN1
293.Vt DirectoryString
294structure defined in RFC 5280 section 4.1.2.4
295and used for ASN.1
296.Vt EDIPartyName
297structures, see
298.Xr EDIPARTYNAME_new 3 .
299When decoding, it accepts any of the types UTF8String, UniversalString,
300BMPString, T61String, or PrintableString. When encoding, it writes
301out the character string type that is actually passed in.
302.Pp
303.Fn d2i_ASN1_PRINTABLE
304and
305.Fn i2d_ASN1_PRINTABLE
306are non-standard variants of
307.Fn d2i_DIRECTORYSTRING
308and
309.Fn i2d_DIRECTORYSTRING
310that also accept IA5String, NumericString, BIT STRING, and SEQUENCE
311ASN.1 values as well as ASN.1 values with with unknown identifier
312octets (0x07, 0x08, 0x09, 0x0b, 0x0d, 0x0e, 0x0f, 0x1d, and 0x1f).
313Even though the standard requires the use of
314.Vt DirectoryString
315in the relative distinguished names described in
316.Xr X509_NAME_ENTRY_new 3 ,
317the library accepts this wider range of choices.
318.Pp
319.Fn d2i_DISPLAYTEXT
320and
321.Fn i2d_DISPLAYTEXT
322decode and encode an ASN1
323.Vt DisplayText
324structure defined in RFC 5280 section 4.2.1.4
325and used for ASN.1
326.Vt UserNotice
327structures in certificate policies, see
328.Xr USERNOTICE_new 3 .
329When decoding, it accepts any of the types UTF8String, IA5String,
330BMPString, or VisibleString. When encoding, it writes out the
331character string type that is actually passed in.
332.Pp
333.Fn d2i_ASN1_TIME
334and
335.Fn i2d_ASN1_TIME
336decode and encode an ASN1
337.Vt Time
338structure defined in RFC 5280 section 4.1
339and used for ASN.1
340.Vt Validity
341structures in certificates, see
342.Xr X509_VAL_new 3 ,
343and also used for certificate revocation lists, see
344.Xr X509_CRL_INFO_new 3 .
345When decoding, it accepts either GeneralizedTime or UTCTime.
346When encoding, it writes out the time type that is actually passed in.
347.Sh RETURN VALUES
348The
349.Fn d2i_*
350decoding functions return an
351.Vt ASN1_STRING
352object or
353.Dv NULL
354if an error occurs.
355.Pp
356The
357.Fn i2d_*
358encoding functions return the number of bytes successfully encoded
359or a negative value if an error occurs.
360.Sh SEE ALSO
361.Xr ASN1_item_d2i 3 ,
362.Xr ASN1_STRING_new 3
363.Sh STANDARDS
364ITU-T Recommendation X.680, also known as ISO/IEC 8824-1:
365Information technology - Abstract Syntax Notation One (ASN.1):
366Specification of basic notation
367.Pp
368RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
369Certificate Revocation List (CRL) Profile