diff options
| author | schwarze <> | 2016-12-25 20:01:48 +0000 |
|---|---|---|
| committer | schwarze <> | 2016-12-25 20:01:48 +0000 |
| commit | d8af6d8d7b9ca4c82730706b04092ac057beb6d2 (patch) | |
| tree | da6c16fdc91f67f1ea7ed85cd3e3e2b23b728095 | |
| parent | fbd1d9664d6d5a073915918e3cf2aaa25559efa5 (diff) | |
| download | openbsd-d8af6d8d7b9ca4c82730706b04092ac057beb6d2.tar.gz openbsd-d8af6d8d7b9ca4c82730706b04092ac057beb6d2.tar.bz2 openbsd-d8af6d8d7b9ca4c82730706b04092ac057beb6d2.zip | |
Add missing functions d2i_PublicKey(3) and i2d_PublicKey(3)
found in OpenSSL doc/man3/d2i_X509.pod.
Simplify one-line description.
Use the same parameter names as in ASN1_item_d2i(3).
Point to ASN1_item_d2i(3) for details.
Add a STANDRADS reference regarding PKCS#8 PrivateKeyInfo.
Mention d2i_PrivateKey_bio(3) and d2i_PrivateKey_fp(3)
in the DESCRIPTION and below RETURN VALUES.
Add some missing markup and tweak some wording.
Add some cross references.
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/man/d2i_PrivateKey.3 | 148 |
1 files changed, 113 insertions, 35 deletions
diff --git a/src/lib/libcrypto/man/d2i_PrivateKey.3 b/src/lib/libcrypto/man/d2i_PrivateKey.3 index 10eb5ebeeb..3c5e9f8cc8 100644 --- a/src/lib/libcrypto/man/d2i_PrivateKey.3 +++ b/src/lib/libcrypto/man/d2i_PrivateKey.3 | |||
| @@ -1,7 +1,24 @@ | |||
| 1 | .\" $OpenBSD: d2i_PrivateKey.3,v 1.3 2016/12/08 20:22:08 jmc Exp $ | 1 | .\" $OpenBSD: d2i_PrivateKey.3,v 1.4 2016/12/25 20:01:48 schwarze Exp $ |
| 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | 2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file is a derived work. |
| 5 | .\" The changes are covered by the following Copyright and license: | ||
| 6 | .\" | ||
| 7 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | ||
| 8 | .\" | ||
| 9 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 10 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 11 | .\" copyright notice and this permission notice appear in all copies. | ||
| 12 | .\" | ||
| 13 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 14 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 15 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 16 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 17 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 20 | .\" | ||
| 21 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
| 5 | .\" Copyright (c) 2016 The OpenSSL Project. All rights reserved. | 22 | .\" Copyright (c) 2016 The OpenSSL Project. All rights reserved. |
| 6 | .\" | 23 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without | 24 | .\" Redistribution and use in source and binary forms, with or without |
| @@ -48,7 +65,7 @@ | |||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 50 | .\" | 67 | .\" |
| 51 | .Dd $Mdocdate: December 8 2016 $ | 68 | .Dd $Mdocdate: December 25 2016 $ |
| 52 | .Dt D2I_PRIVATEKEY 3 | 69 | .Dt D2I_PRIVATEKEY 3 |
| 53 | .Os | 70 | .Os |
| 54 | .Sh NAME | 71 | .Sh NAME |
| @@ -56,44 +73,64 @@ | |||
| 56 | .Nm d2i_AutoPrivateKey , | 73 | .Nm d2i_AutoPrivateKey , |
| 57 | .Nm i2d_PrivateKey , | 74 | .Nm i2d_PrivateKey , |
| 58 | .Nm d2i_PrivateKey_bio , | 75 | .Nm d2i_PrivateKey_bio , |
| 59 | .Nm d2i_PrivateKey_fp | 76 | .Nm d2i_PrivateKey_fp , |
| 60 | .Nd decode and encode functions for reading and saving EVP_PKEY structures | 77 | .Nm d2i_PublicKey , |
| 78 | .Nm i2d_PublicKey | ||
| 79 | .Nd decode and encode EVP_PKEY objects | ||
| 61 | .Sh SYNOPSIS | 80 | .Sh SYNOPSIS |
| 62 | .In openssl/evp.h | 81 | .In openssl/evp.h |
| 63 | .Ft EVP_PKEY * | 82 | .Ft EVP_PKEY * |
| 64 | .Fo d2i_PrivateKey | 83 | .Fo d2i_PrivateKey |
| 65 | .Fa "int type" | 84 | .Fa "int type" |
| 66 | .Fa "EVP_PKEY **a" | 85 | .Fa "EVP_PKEY **val_out" |
| 67 | .Fa "const unsigned char **pp" | 86 | .Fa "const unsigned char **des_in" |
| 68 | .Fa "long length" | 87 | .Fa "long length" |
| 69 | .Fc | 88 | .Fc |
| 70 | .Ft EVP_PKEY * | 89 | .Ft EVP_PKEY * |
| 71 | .Fo d2i_AutoPrivateKey | 90 | .Fo d2i_AutoPrivateKey |
| 72 | .Fa "EVP_PKEY **a" | 91 | .Fa "EVP_PKEY **val_out" |
| 73 | .Fa "const unsigned char **pp" | 92 | .Fa "const unsigned char **des_in" |
| 74 | .Fa "long length" | 93 | .Fa "long length" |
| 75 | .Fc | 94 | .Fc |
| 76 | .Ft int | 95 | .Ft int |
| 77 | .Fo i2d_PrivateKey | 96 | .Fo i2d_PrivateKey |
| 78 | .Fa "EVP_PKEY *a" | 97 | .Fa "EVP_PKEY *val_in" |
| 79 | .Fa "unsigned char **pp" | 98 | .Fa "unsigned char **des_out" |
| 80 | .Fc | 99 | .Fc |
| 81 | .Ft EVP_PKEY * | 100 | .Ft EVP_PKEY * |
| 82 | .Fo d2i_PrivateKey_bio | 101 | .Fo d2i_PrivateKey_bio |
| 83 | .Fa "BIO *bp" | 102 | .Fa "BIO *in_bio" |
| 84 | .Fa "EVP_PKEY **a" | 103 | .Fa "EVP_PKEY **val_out" |
| 85 | .Fc | 104 | .Fc |
| 86 | .Ft EVP_PKEY * | 105 | .Ft EVP_PKEY * |
| 87 | .Fo d2i_PrivateKey_fp | 106 | .Fo d2i_PrivateKey_fp |
| 88 | .Fa "FILE *fp" | 107 | .Fa "FILE *in_fp" |
| 89 | .Fa "EVP_PKEY **a" | 108 | .Fa "EVP_PKEY **val_out" |
| 109 | .Fc | ||
| 110 | .Ft EVP_PKEY * | ||
| 111 | .Fo d2i_PublicKey | ||
| 112 | .Fa "int type" | ||
| 113 | .Fa "EVP_PKEY **val_out" | ||
| 114 | .Fa "const unsigned char **des_in" | ||
| 115 | .Fa "long length" | ||
| 116 | .Fc | ||
| 117 | .Ft int | ||
| 118 | .Fo i2d_PublicKey | ||
| 119 | .Fa "EVP_PKEY *val_in" | ||
| 120 | .Fa "unsigned char **des_out" | ||
| 90 | .Fc | 121 | .Fc |
| 91 | .Sh DESCRIPTION | 122 | .Sh DESCRIPTION |
| 123 | These are algorithm-independent interfaces to decode and encode | ||
| 124 | private and public keys. | ||
| 125 | For details about the semantics, examples, caveats, and bugs, see | ||
| 126 | .Xr ASN1_item_d2i 3 . | ||
| 127 | .Pp | ||
| 92 | .Fn d2i_PrivateKey | 128 | .Fn d2i_PrivateKey |
| 93 | decodes a private key using algorithm | 129 | decodes a private key using algorithm |
| 94 | .Fa type . | 130 | .Fa type . |
| 95 | It attempts to use any key specific format or PKCS#8 unencrypted | 131 | It attempts to use any key specific format or the PKCS#8 unencrypted |
| 96 | PrivateKeyInfo format. | 132 | .Vt PrivateKeyInfo |
| 133 | format defined in RFC 5208 section 5. | ||
| 97 | The | 134 | The |
| 98 | .Fa type | 135 | .Fa type |
| 99 | parameter should be a public key algorithm constant such as | 136 | parameter should be a public key algorithm constant such as |
| @@ -104,18 +141,26 @@ An error occurs if the decoded key does not match | |||
| 104 | .Fn d2i_AutoPrivateKey | 141 | .Fn d2i_AutoPrivateKey |
| 105 | is similar to | 142 | is similar to |
| 106 | .Fn d2i_PrivateKey | 143 | .Fn d2i_PrivateKey |
| 107 | except that it attempts to automatically detect the private key format. | 144 | except that it attempts to automatically detect the algorithm. |
| 145 | .Pp | ||
| 146 | .Fn d2i_PrivateKey_bio | ||
| 147 | and | ||
| 148 | .Fn d2i_PrivateKey_fp | ||
| 149 | are similar to | ||
| 150 | .Fn d2i_PrivateKey | ||
| 151 | except that they read from a | ||
| 152 | .Vt BIO | ||
| 153 | or | ||
| 154 | .Vt FILE | ||
| 155 | pointer. | ||
| 108 | .Pp | 156 | .Pp |
| 109 | .Fn i2d_PrivateKey | 157 | .Fn i2d_PrivateKey |
| 110 | encodes | 158 | encodes |
| 111 | .Fa a . | 159 | .Fa val_in . |
| 112 | It uses a key specific format or, if none is defined for that key type, | 160 | It uses a key specific format or, if none is defined for that key type, |
| 113 | PKCS#8 unencrypted PrivateKeyInfo format. | 161 | the PKCS#8 unencrypted |
| 114 | .Pp | 162 | .Vt PrivateKeyInfo |
| 115 | These functions are similar to the | 163 | format. |
| 116 | .Xr d2i_X509 3 | ||
| 117 | functions; see | ||
| 118 | .Xr d2i_X509 3 . | ||
| 119 | .Pp | 164 | .Pp |
| 120 | All these functions use DER format and unencrypted keys. | 165 | All these functions use DER format and unencrypted keys. |
| 121 | Applications wishing to encrypt or decrypt private keys should use other | 166 | Applications wishing to encrypt or decrypt private keys should use other |
| @@ -124,31 +169,64 @@ functions such as | |||
| 124 | instead. | 169 | instead. |
| 125 | .Pp | 170 | .Pp |
| 126 | If | 171 | If |
| 127 | .Pf * Fa a | 172 | .Pf * Fa val_out |
| 128 | is not NULL when calling | 173 | is not |
| 174 | .Dv NULL | ||
| 175 | when calling | ||
| 129 | .Fn d2i_PrivateKey | 176 | .Fn d2i_PrivateKey |
| 130 | or | 177 | or |
| 131 | .Fn d2i_AutoPrivateKey | 178 | .Fn d2i_AutoPrivateKey |
| 132 | (i.e. an existing structure is being reused) and the key format is | 179 | (i.e. an existing structure is being reused) and the key format is |
| 133 | PKCS#8, then | 180 | PKCS#8, then |
| 134 | .Pf * Fa a | 181 | .Pf * Fa val_out |
| 135 | will be freed and replaced on a successful call. | 182 | will be freed and replaced on a successful call. |
| 183 | .Pp | ||
| 184 | .Fn d2i_PublicKey | ||
| 185 | calls | ||
| 186 | .Xr d2i_DSAPublicKey 3 , | ||
| 187 | .Xr o2i_ECPublicKey 3 , | ||
| 188 | or | ||
| 189 | .Xr d2i_RSAPublicKey 3 | ||
| 190 | depending on | ||
| 191 | .Fa type | ||
| 192 | and stores the result in the returned | ||
| 193 | .Vt EVP_PKEY | ||
| 194 | object. | ||
| 195 | .Pp | ||
| 196 | .Fn i2d_PublicKey | ||
| 197 | calls | ||
| 198 | .Xr i2d_DSAPublicKey 3 , | ||
| 199 | .Xr i2o_ECPublicKey 3 , | ||
| 200 | or | ||
| 201 | .Xr i2d_RSAPublicKey 3 | ||
| 202 | depending on the algorithm used by | ||
| 203 | .Fa val_in . | ||
| 136 | .Sh RETURN VALUES | 204 | .Sh RETURN VALUES |
| 137 | .Fn d2i_PrivateKey | 205 | .Fn d2i_PrivateKey , |
| 206 | .Fn d2i_AutoPrivateKey , | ||
| 207 | .Fn d2i_PrivateKey_bio , | ||
| 208 | .Fn d2i_PrivateKey_fp , | ||
| 138 | and | 209 | and |
| 139 | .Fn d2i_AutoPrivateKey | 210 | .Fn d2i_PublicKey |
| 140 | return a valid | 211 | return a valid |
| 141 | .Vt EVP_KEY | 212 | .Vt EVP_KEY |
| 142 | structure or | 213 | structure or |
| 143 | .Dv NULL | 214 | .Dv NULL |
| 144 | if an error occurs. | 215 | if an error occurs. |
| 145 | The error code can be obtained by calling | ||
| 146 | .Xr ERR_get_error 3 . | ||
| 147 | .Pp | 216 | .Pp |
| 148 | .Fn i2d_PrivateKey | 217 | .Fn i2d_PrivateKey |
| 149 | returns the number of bytes successfully encoded or a negative value if | 218 | and |
| 219 | .Fn i2d_PublicKey | ||
| 220 | return the number of bytes successfully encoded or a negative value if | ||
| 150 | an error occurs. | 221 | an error occurs. |
| 151 | The error code can be obtained by calling | 222 | .Pp |
| 223 | For all functions, the error code can be obtained by calling | ||
| 152 | .Xr ERR_get_error 3 . | 224 | .Xr ERR_get_error 3 . |
| 153 | .Sh SEE ALSO | 225 | .Sh SEE ALSO |
| 154 | .Xr d2i_PKCS8PrivateKey_bio 3 | 226 | .Xr d2i_PKCS8PrivateKey_bio 3 , |
| 227 | .Xr EVP_PKEY_type 3 , | ||
| 228 | .Xr PEM_write_PrivateKey 3 , | ||
| 229 | .Xr PKCS8_PRIV_KEY_INFO_new 3 | ||
| 230 | .Sh STANDARDS | ||
| 231 | RFC 5208: Public-Key Cryptography Standards (PKCS) #8: Private-Key | ||
| 232 | Information Syntax Specification | ||
