summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2016-12-26 16:36:34 +0000
committerschwarze <>2016-12-26 16:36:34 +0000
commit57e1f989d9fcf62c64f0a5143c2213a4c5d321a2 (patch)
treea46779366b74ad342e705a4224263b910e76e986
parentcd0dd75586ebcba67ebc915ba3dc601d1a03f33a (diff)
downloadopenbsd-57e1f989d9fcf62c64f0a5143c2213a4c5d321a2.tar.gz
openbsd-57e1f989d9fcf62c64f0a5143c2213a4c5d321a2.tar.bz2
openbsd-57e1f989d9fcf62c64f0a5143c2213a4c5d321a2.zip
Basic cleanup:
Simplify one-line description. List each function with the correct header file. Use the same parameter names as in ASN1_item_d2i(3). Point to ASN1_item_d2i(3) for details. Sort the text. Add some useful cross references.
-rw-r--r--src/lib/libcrypto/man/d2i_RSAPublicKey.3182
1 files changed, 102 insertions, 80 deletions
diff --git a/src/lib/libcrypto/man/d2i_RSAPublicKey.3 b/src/lib/libcrypto/man/d2i_RSAPublicKey.3
index 22d904157f..7a65bed7a4 100644
--- a/src/lib/libcrypto/man/d2i_RSAPublicKey.3
+++ b/src/lib/libcrypto/man/d2i_RSAPublicKey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: d2i_RSAPublicKey.3,v 1.6 2016/12/25 22:15:10 schwarze Exp $ 1.\" $OpenBSD: d2i_RSAPublicKey.3,v 1.7 2016/12/26 16:36:34 schwarze Exp $
2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and 4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
@@ -50,93 +50,97 @@
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\" 52.\"
53.Dd $Mdocdate: December 25 2016 $ 53.Dd $Mdocdate: December 26 2016 $
54.Dt D2I_RSAPUBLICKEY 3 54.Dt D2I_RSAPUBLICKEY 3
55.Os 55.Os
56.Sh NAME 56.Sh NAME
57.Nm d2i_RSAPublicKey , 57.Nm d2i_RSAPublicKey ,
58.Nm i2d_RSAPublicKey , 58.Nm i2d_RSAPublicKey ,
59.Nm d2i_RSAPrivateKey ,
60.Nm i2d_RSAPrivateKey ,
61.Nm d2i_Netscape_RSA ,
62.Nm i2d_Netscape_RSA ,
59.Nm d2i_RSA_PUBKEY , 63.Nm d2i_RSA_PUBKEY ,
60.Nm i2d_RSA_PUBKEY , 64.Nm i2d_RSA_PUBKEY ,
61.Nm d2i_RSA_PUBKEY_bio , 65.Nm d2i_RSA_PUBKEY_bio ,
62.Nm d2i_RSA_PUBKEY_fp , 66.Nm d2i_RSA_PUBKEY_fp ,
63.Nm i2d_RSA_PUBKEY_bio , 67.Nm i2d_RSA_PUBKEY_bio ,
64.Nm i2d_RSA_PUBKEY_fp , 68.Nm i2d_RSA_PUBKEY_fp
65.Nm d2i_RSAPrivateKey , 69.Nd decode and encode RSA keys
66.Nm i2d_RSAPrivateKey ,
67.Nm i2d_Netscape_RSA ,
68.Nm d2i_Netscape_RSA
69.Nd RSA public and private key encoding functions
70.Sh SYNOPSIS 70.Sh SYNOPSIS
71.In openssl/rsa.h 71.In openssl/rsa.h
72.In openssl/x509.h
73.Ft RSA * 72.Ft RSA *
74.Fo d2i_RSAPublicKey 73.Fo d2i_RSAPublicKey
75.Fa "RSA **a" 74.Fa "RSA **val_out"
76.Fa "const unsigned char **pp" 75.Fa "const unsigned char **der_in"
77.Fa "long length" 76.Fa "long length"
78.Fc 77.Fc
79.Ft int 78.Ft int
80.Fo i2d_RSAPublicKey 79.Fo i2d_RSAPublicKey
81.Fa "RSA *a" 80.Fa "RSA *val_in"
82.Fa "unsigned char **pp" 81.Fa "unsigned char **der_out"
82.Fc
83.Ft RSA *
84.Fo d2i_RSAPrivateKey
85.Fa "RSA **val_out"
86.Fa "const unsigned char **der_in"
87.Fa "long length"
88.Fc
89.Ft int
90.Fo i2d_RSAPrivateKey
91.Fa "RSA *val_in"
92.Fa "unsigned char **der_out"
93.Fc
94.Ft RSA *
95.Fo d2i_Netscape_RSA
96.Fa "RSA **val_out"
97.Fa "const unsigned char **der_in"
98.Fa "long length"
99.Fa "int (*cb)()"
100.Fc
101.Ft int
102.Fo i2d_Netscape_RSA
103.Fa "RSA *val_in"
104.Fa "unsigned char **der_out"
105.Fa "int (*cb)()"
83.Fc 106.Fc
107.In openssl/x509.h
84.Ft RSA * 108.Ft RSA *
85.Fo d2i_RSA_PUBKEY 109.Fo d2i_RSA_PUBKEY
86.Fa "RSA **a" 110.Fa "RSA **val_out"
87.Fa "const unsigned char **pp" 111.Fa "const unsigned char **der_in"
88.Fa "long length" 112.Fa "long length"
89.Fc 113.Fc
90.Ft int 114.Ft int
91.Fo i2d_RSA_PUBKEY 115.Fo i2d_RSA_PUBKEY
92.Fa "RSA *a" 116.Fa "RSA *val_in"
93.Fa "unsigned char **pp" 117.Fa "unsigned char **der_out"
94.Fc 118.Fc
95.Ft RSA * 119.Ft RSA *
96.Fo d2i_RSA_PUBKEY_bio 120.Fo d2i_RSA_PUBKEY_bio
97.Fa "BIO *bp" 121.Fa "BIO *in_bio"
98.Fa "RSA **a" 122.Fa "RSA **val_out"
99.Fc 123.Fc
100.Ft RSA * 124.Ft RSA *
101.Fo d2i_RSA_PUBKEY_fp 125.Fo d2i_RSA_PUBKEY_fp
102.Fa "FILE *fp" 126.Fa "FILE *in_fp"
103.Fa "RSA **a" 127.Fa "RSA **val_out"
104.Fc 128.Fc
105.Ft int 129.Ft int
106.Fo i2d_RSA_PUBKEY_bio 130.Fo i2d_RSA_PUBKEY_bio
107.Fa "BIO *bp" 131.Fa "BIO *out_bio"
108.Fa "RSA *a" 132.Fa "RSA *val_in"
109.Fc 133.Fc
110.Ft int 134.Ft int
111.Fo i2d_RSA_PUBKEY_fp 135.Fo i2d_RSA_PUBKEY_fp
112.Fa "FILE *fp" 136.Fa "FILE *out_fp"
113.Fa "RSA *a" 137.Fa "RSA *val_in"
114.Fc
115.Ft RSA *
116.Fo d2i_RSAPrivateKey
117.Fa "RSA **a"
118.Fa "const unsigned char **pp"
119.Fa "long length"
120.Fc
121.Ft int
122.Fo i2d_RSAPrivateKey
123.Fa "RSA *a"
124.Fa "unsigned char **pp"
125.Fc
126.Ft int
127.Fo i2d_Netscape_RSA
128.Fa "RSA *a"
129.Fa "unsigned char **pp"
130.Fa "int (*cb)()"
131.Fc
132.Ft RSA *
133.Fo d2i_Netscape_RSA
134.Fa "RSA **a"
135.Fa "const unsigned char **pp"
136.Fa "long length"
137.Fa "int (*cb)()"
138.Fc 138.Fc
139.Sh DESCRIPTION 139.Sh DESCRIPTION
140These functions decode and encode RSA private and public keys.
141For details about the semantics, examples, caveats, and bugs, see
142.Xr ASN1_item_d2i 3 .
143.Pp
140.Fn d2i_RSAPublicKey 144.Fn d2i_RSAPublicKey
141and 145and
142.Fn i2d_RSAPublicKey 146.Fn i2d_RSAPublicKey
@@ -144,55 +148,73 @@ decode and encode a PKCS#1
144.Vt RSAPublicKey 148.Vt RSAPublicKey
145structure. 149structure.
146.Pp 150.Pp
151.Fn d2i_RSAPrivateKey
152and
153.Fn i2d_RSAPrivateKey
154decode and encode a PKCS#1
155.Vt RSAPrivateKey
156structure.
157The
158.Vt RSA
159structure passed to the private key encoding functions should have
160all the PKCS#1 private key components present.
161The data encoded by the private key functions is unencrypted and
162therefore offers no private key security.
163.Pp
164.Fn d2i_Netscape_RSA
165and
166.Fn i2d_Netscape_RSA
167decode and encode an RSA private key in NET format.
168These functions are present to provide compatibility with
169certain very old software.
170The NET format has some severe security weaknesses and should be
171avoided if possible.
172.Pp
147.Fn d2i_RSA_PUBKEY 173.Fn d2i_RSA_PUBKEY
148and 174and
149.Fn i2d_RSA_PUBKEY 175.Fn i2d_RSA_PUBKEY
150decode and encode an RSA public key using an ASN.1 176decode and encode an RSA public key using an ASN.1
151.Vt SubjectPublicKeyInfo 177.Vt SubjectPublicKeyInfo
152(certificate public key) structure. 178structure.
153.Pp
154.Fn d2i_RSA_PUBKEY_bio , 179.Fn d2i_RSA_PUBKEY_bio ,
155.Fn d2i_RSA_PUBKEY_fp , 180.Fn d2i_RSA_PUBKEY_fp ,
156.Fn i2d_RSA_PUBKEY_bio , 181.Fn i2d_RSA_PUBKEY_bio ,
157and 182and
158.Fn i2d_RSA_PUBKEY_fp 183.Fn i2d_RSA_PUBKEY_fp
159are similar to 184are similar except that they decode or encode using a
160.Fn d2i_RSA_PUBKEY
161and
162.Fn i2d_RSA_PUBKEY
163except that they decode or encode using a
164.Vt BIO 185.Vt BIO
165or 186or
166.Vt FILE 187.Vt FILE
167pointer. 188pointer.
168.Pp 189.Sh RETURN VALUES
190.Fn d2i_RSAPublicKey ,
169.Fn d2i_RSAPrivateKey , 191.Fn d2i_RSAPrivateKey ,
170.Fn i2d_RSAPrivateKey
171decode and encode a PKCS#1
172.Vt RSAPrivateKey
173structure.
174.Pp
175.Fn d2i_Netscape_RSA , 192.Fn d2i_Netscape_RSA ,
176.Fn i2d_Netscape_RSA 193.Fn d2i_RSA_PUBKEY ,
177decode and encode an RSA private key in NET format. 194.Fn d2i_RSA_PUBKEY_bio ,
178.Pp
179The usage of all of these functions is similar to
180.Xr d2i_X509 3
181and 195and
182.Xr i2d_X509 3 . 196.Fn d2i_RSA_PUBKEY_fp
183.Pp 197return a valid
184The
185.Vt RSA 198.Vt RSA
186structure passed to the private key encoding functions should have all 199object or
187the PKCS#1 private key components present. 200.Dv NULL
201if an error occurs.
188.Pp 202.Pp
189The data encoded by the private key functions is unencrypted and 203.Fn i2d_RSAPublicKey ,
190therefore offers no private key security. 204.Fn i2d_RSAPrivateKey ,
205.Fn i2d_Netscape_RSA ,
206and
207.Fn i2d_RSA_PUBKEY
208return the number of bytes successfully encoded or a negative value
209if an error occurs.
191.Pp 210.Pp
192The NET format functions are present to provide compatibility with 211.Fn i2d_RSA_PUBKEY_bio
193certain very old software. 212and
194This format has some severe security weaknesses and should be avoided if 213.Fn i2d_RSA_PUBKEY_fp
195possible. 214return 1 for success or 0 if an error occurs.
196.Sh SEE ALSO 215.Sh SEE ALSO
197.Xr d2i_X509 3 , 216.Xr ASN1_item_d2i 3 ,
198.Xr RSA_new 3 217.Xr EVP_PKEY_set1_RSA 3 ,
218.Xr PEM_write_RSAPrivateKey 3 ,
219.Xr RSA_new 3 ,
220.Xr X509_PUBKEY_new 3