xref: /openbsd/lib/libcrypto/man/d2i_X509_SIG.3 (revision 09467b48)
1.\"	$OpenBSD: d2i_X509_SIG.3,v 1.9 2018/03/27 17:35:50 schwarze Exp $
2.\"	OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
3.\"
4.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: March 27 2018 $
19.Dt D2I_X509_SIG 3
20.Os
21.Sh NAME
22.Nm d2i_X509_SIG ,
23.Nm i2d_X509_SIG ,
24.Nm d2i_PKCS8_bio ,
25.Nm i2d_PKCS8_bio ,
26.Nm d2i_PKCS8_fp ,
27.Nm i2d_PKCS8_fp
28.\" In the next line, the number "7" is not a typo.
29.\" These functions are misnamed.
30.Nd decode and encode PKCS#7 digest information
31.Sh SYNOPSIS
32.In openssl/x509.h
33.Ft X509_SIG *
34.Fo d2i_X509_SIG
35.Fa "X509_SIG **val_out"
36.Fa "unsigned char **der_in"
37.Fa "long length"
38.Fc
39.Ft int
40.Fo i2d_X509_SIG
41.Fa "X509_SIG *val_in"
42.Fa "unsigned char **der_out"
43.Fc
44.Ft X509_SIG *
45.Fo d2i_PKCS8_bio
46.Fa "BIO *in_bio"
47.Fa "X509_SIG **val_out"
48.Fc
49.Ft int
50.Fo i2d_PKCS8_bio
51.Fa "BIO *out_bio"
52.Fa "X509_SIG *val_in"
53.Fc
54.Ft X509_SIG *
55.Fo d2i_PKCS8_fp
56.Fa "FILE *in_fp"
57.Fa "X509_SIG **val_out"
58.Fc
59.Ft int
60.Fo i2d_PKCS8_fp
61.Fa "FILE *out_fp"
62.Fa "X509_SIG *val_in"
63.Fc
64.Sh DESCRIPTION
65.Fn d2i_X509_SIG
66and
67.Fn i2d_X509_SIG
68decode and encode an ASN.1
69.Vt DigestInfo
70structure defined in RFC 2315 section 9.4
71and equivalently in RFC 8017 section 9.2.
72For details about the semantics, examples, caveats, and bugs, see
73.Xr ASN1_item_d2i 3 .
74.Pp
75.Fn d2i_PKCS8_bio
76and
77.Fn d2i_PKCS8_fp
78are similar to
79.Fn d2i_X509_SIG
80except that they read from a
81.Vt BIO
82or
83.Vt FILE
84pointer.
85.Pp
86.Fn i2d_PKCS8_bio
87and
88.Fn i2d_PKCS8_fp
89are similar to
90.Fn i2d_X509_SIG
91except that they write to a
92.Vt BIO
93or
94.Vt FILE
95pointer.
96.Sh RETURN VALUES
97.Fn d2i_X509_SIG ,
98.Fn d2i_PKCS8_bio ,
99and
100.Fn d2i_PKCS8_fp
101return a
102.Vt X509_SIG
103object or
104.Dv NULL
105if an error occurs.
106.Pp
107.Fn i2d_X509_SIG
108returns the number of bytes successfully encoded or a negative value
109if an error occurs.
110.Pp
111.Fn i2d_PKCS8_bio
112and
113.Fn i2d_PKCS8_fp
114return 1 for success or 0 if an error occurs.
115.Sh SEE ALSO
116.Xr ASN1_item_d2i 3 ,
117.Xr PKCS7_new 3 ,
118.Xr RSA_sign 3 ,
119.Xr X509_SIG_new 3
120.Sh STANDARDS
121RFC 2315: PKCS #7: Cryptographic Message Syntax,
122section 9: Signed-data content type
123.Pp
124RFC 8017: PKCS #1: RSA Cryptography Specifications,
125section 9: Encoding Methods for Signatures
126.Sh HISTORY
127.Fn d2i_X509_SIG
128and
129.Fn i2d_X509_SIG
130first appeared in SSLeay 0.5.1 and have been available since
131.Ox 2.4 .
132.Pp
133.Fn d2i_PKCS8_bio ,
134.Fn i2d_PKCS8_bio ,
135.Fn d2i_PKCS8_fp ,
136and
137.Fn i2d_PKCS8_fp
138first appeared in OpenSSL 0.9.4 and have been available since
139.Ox 2.6 .
140.Sh BUGS
141.Fn d2i_PKCS8_bio ,
142.Fn i2d_PKCS8_bio ,
143.Fn d2i_PKCS8_fp ,
144and
145.Fn i2d_PKCS8_fp
146are severely misnamed and should have been called
147.Dq d2i_X509_SIG_bio
148and so on.
149.Pp
150Or arguably, the
151.Vt X509_SIG
152object is misnamed itself, considering that it represents
153.Vt DigestInfo
154from PKCS#7 and PKCS#1.
155Then again, calling it
156.Dq PKCS8
157instead clearly isn't an improvement.
158.Pp
159Either way, these names just don't fit.
160