diff options
Diffstat (limited to 'src/lib/libcrypto/man/X509_PUBKEY_new.3')
| -rw-r--r-- | src/lib/libcrypto/man/X509_PUBKEY_new.3 | 368 |
1 files changed, 0 insertions, 368 deletions
diff --git a/src/lib/libcrypto/man/X509_PUBKEY_new.3 b/src/lib/libcrypto/man/X509_PUBKEY_new.3 deleted file mode 100644 index 69afcb5adb..0000000000 --- a/src/lib/libcrypto/man/X509_PUBKEY_new.3 +++ /dev/null | |||
| @@ -1,368 +0,0 @@ | |||
| 1 | .\" $OpenBSD: X509_PUBKEY_new.3,v 1.16 2020/06/19 14:04:25 schwarze Exp $ | ||
| 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | ||
| 3 | .\" | ||
| 4 | .\" This file is a derived work. | ||
| 5 | .\" The changes are covered by the following Copyright and license: | ||
| 6 | .\" | ||
| 7 | .\" Copyright (c) 2020 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>. | ||
| 22 | .\" Copyright (c) 2016 The OpenSSL Project. All rights reserved. | ||
| 23 | .\" | ||
| 24 | .\" Redistribution and use in source and binary forms, with or without | ||
| 25 | .\" modification, are permitted provided that the following conditions | ||
| 26 | .\" are met: | ||
| 27 | .\" | ||
| 28 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 29 | .\" notice, this list of conditions and the following disclaimer. | ||
| 30 | .\" | ||
| 31 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 32 | .\" notice, this list of conditions and the following disclaimer in | ||
| 33 | .\" the documentation and/or other materials provided with the | ||
| 34 | .\" distribution. | ||
| 35 | .\" | ||
| 36 | .\" 3. All advertising materials mentioning features or use of this | ||
| 37 | .\" software must display the following acknowledgment: | ||
| 38 | .\" "This product includes software developed by the OpenSSL Project | ||
| 39 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 40 | .\" | ||
| 41 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 42 | .\" endorse or promote products derived from this software without | ||
| 43 | .\" prior written permission. For written permission, please contact | ||
| 44 | .\" openssl-core@openssl.org. | ||
| 45 | .\" | ||
| 46 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 47 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 48 | .\" permission of the OpenSSL Project. | ||
| 49 | .\" | ||
| 50 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 51 | .\" acknowledgment: | ||
| 52 | .\" "This product includes software developed by the OpenSSL Project | ||
| 53 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 54 | .\" | ||
| 55 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 56 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 57 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 58 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 59 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 60 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 61 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 62 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 63 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 64 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 67 | .\" | ||
| 68 | .Dd $Mdocdate: June 19 2020 $ | ||
| 69 | .Dt X509_PUBKEY_NEW 3 | ||
| 70 | .Os | ||
| 71 | .Sh NAME | ||
| 72 | .Nm X509_PUBKEY_new , | ||
| 73 | .Nm X509_PUBKEY_free , | ||
| 74 | .Nm X509_PUBKEY_set , | ||
| 75 | .Nm X509_PUBKEY_get0 , | ||
| 76 | .Nm X509_PUBKEY_get , | ||
| 77 | .Nm d2i_PUBKEY , | ||
| 78 | .Nm i2d_PUBKEY , | ||
| 79 | .Nm d2i_PUBKEY_bio , | ||
| 80 | .Nm d2i_PUBKEY_fp , | ||
| 81 | .Nm i2d_PUBKEY_fp , | ||
| 82 | .Nm i2d_PUBKEY_bio , | ||
| 83 | .Nm X509_PUBKEY_set0_param , | ||
| 84 | .Nm X509_PUBKEY_get0_param | ||
| 85 | .Nd X.509 SubjectPublicKeyInfo structure | ||
| 86 | .Sh SYNOPSIS | ||
| 87 | .In openssl/x509.h | ||
| 88 | .Ft X509_PUBKEY * | ||
| 89 | .Fn X509_PUBKEY_new void | ||
| 90 | .Ft void | ||
| 91 | .Fo X509_PUBKEY_free | ||
| 92 | .Fa "X509_PUBKEY *a" | ||
| 93 | .Fc | ||
| 94 | .Ft int | ||
| 95 | .Fo X509_PUBKEY_set | ||
| 96 | .Fa "X509_PUBKEY **x" | ||
| 97 | .Fa "EVP_PKEY *pkey" | ||
| 98 | .Fc | ||
| 99 | .Ft EVP_PKEY * | ||
| 100 | .Fo X509_PUBKEY_get0 | ||
| 101 | .Fa "X509_PUBKEY *key" | ||
| 102 | .Fc | ||
| 103 | .Ft EVP_PKEY * | ||
| 104 | .Fo X509_PUBKEY_get | ||
| 105 | .Fa "X509_PUBKEY *key" | ||
| 106 | .Fc | ||
| 107 | .Ft EVP_PKEY * | ||
| 108 | .Fo d2i_PUBKEY | ||
| 109 | .Fa "EVP_PKEY **a" | ||
| 110 | .Fa "const unsigned char **pp" | ||
| 111 | .Fa "long length" | ||
| 112 | .Fc | ||
| 113 | .Ft int | ||
| 114 | .Fo i2d_PUBKEY | ||
| 115 | .Fa "EVP_PKEY *a" | ||
| 116 | .Fa "unsigned char **pp" | ||
| 117 | .Fc | ||
| 118 | .Ft EVP_PKEY * | ||
| 119 | .Fo d2i_PUBKEY_bio | ||
| 120 | .Fa "BIO *bp" | ||
| 121 | .Fa "EVP_PKEY **a" | ||
| 122 | .Fc | ||
| 123 | .Ft EVP_PKEY * | ||
| 124 | .Fo d2i_PUBKEY_fp | ||
| 125 | .Fa "FILE *fp" | ||
| 126 | .Fa "EVP_PKEY **a" | ||
| 127 | .Fc | ||
| 128 | .Ft int | ||
| 129 | .Fo i2d_PUBKEY_fp | ||
| 130 | .Fa "FILE *fp" | ||
| 131 | .Fa "EVP_PKEY *pkey" | ||
| 132 | .Fc | ||
| 133 | .Ft int | ||
| 134 | .Fo i2d_PUBKEY_bio | ||
| 135 | .Fa "BIO *bp" | ||
| 136 | .Fa "EVP_PKEY *pkey" | ||
| 137 | .Fc | ||
| 138 | .Ft int | ||
| 139 | .Fo X509_PUBKEY_set0_param | ||
| 140 | .Fa "X509_PUBKEY *pub" | ||
| 141 | .Fa "ASN1_OBJECT *aobj" | ||
| 142 | .Fa "int ptype" | ||
| 143 | .Fa "void *pval" | ||
| 144 | .Fa "unsigned char *penc" | ||
| 145 | .Fa "int penclen" | ||
| 146 | .Fc | ||
| 147 | .Ft int | ||
| 148 | .Fo X509_PUBKEY_get0_param | ||
| 149 | .Fa "ASN1_OBJECT **ppkalg" | ||
| 150 | .Fa "const unsigned char **pk" | ||
| 151 | .Fa "int *ppklen" | ||
| 152 | .Fa "X509_ALGOR **pa" | ||
| 153 | .Fa "X509_PUBKEY *pub" | ||
| 154 | .Fc | ||
| 155 | .Sh DESCRIPTION | ||
| 156 | The | ||
| 157 | .Vt X509_PUBKEY | ||
| 158 | structure represents the ASN.1 | ||
| 159 | .Vt SubjectPublicKeyInfo | ||
| 160 | structure defined in RFC 5280 section 4.1 and used in certificates | ||
| 161 | and certificate requests. | ||
| 162 | .Pp | ||
| 163 | .Fn X509_PUBKEY_new | ||
| 164 | allocates and initializes an | ||
| 165 | .Vt X509_PUBKEY | ||
| 166 | structure. | ||
| 167 | .Pp | ||
| 168 | .Fn X509_PUBKEY_free | ||
| 169 | frees up the | ||
| 170 | .Vt X509_PUBKEY | ||
| 171 | structure | ||
| 172 | .Fa a . | ||
| 173 | If | ||
| 174 | .Fa a | ||
| 175 | is a | ||
| 176 | .Dv NULL | ||
| 177 | pointer, no action occurs. | ||
| 178 | .Pp | ||
| 179 | .Fn X509_PUBKEY_set | ||
| 180 | sets the public key in | ||
| 181 | .Pf * Fa x | ||
| 182 | to the public key contained in the | ||
| 183 | .Vt EVP_PKEY | ||
| 184 | structure | ||
| 185 | .Fa pkey . | ||
| 186 | If | ||
| 187 | .Pf * Fa x | ||
| 188 | is not | ||
| 189 | .Dv NULL , | ||
| 190 | any existing public key structure will be freed. | ||
| 191 | .Pp | ||
| 192 | .Fn X509_PUBKEY_get0 | ||
| 193 | returns the public key contained in | ||
| 194 | .Fa key . | ||
| 195 | The returned value is an internal pointer which must not be freed after use. | ||
| 196 | .Pp | ||
| 197 | .Fn X509_PUBKEY_get | ||
| 198 | is similar to | ||
| 199 | .Fn X509_PUBKEY_get0 | ||
| 200 | except that the reference | ||
| 201 | count on the returned key is incremented so it must be freed using | ||
| 202 | .Xr EVP_PKEY_free 3 | ||
| 203 | after use. | ||
| 204 | .Pp | ||
| 205 | .Fn d2i_PUBKEY | ||
| 206 | and | ||
| 207 | .Fn i2d_PUBKEY | ||
| 208 | decode and encode an | ||
| 209 | .Vt EVP_PKEY | ||
| 210 | structure using | ||
| 211 | .Vt SubjectPublicKeyInfo | ||
| 212 | format. | ||
| 213 | For details about the semantics, examples, caveats, and bugs, see | ||
| 214 | .Xr ASN1_item_d2i 3 . | ||
| 215 | .Fn d2i_PUBKEY_bio , | ||
| 216 | .Fn d2i_PUBKEY_fp , | ||
| 217 | .Fn i2d_PUBKEY_bio | ||
| 218 | and | ||
| 219 | .Fn i2d_PUBKEY_fp | ||
| 220 | are similar except they decode or encode using a | ||
| 221 | .Vt BIO | ||
| 222 | or | ||
| 223 | .Vt FILE | ||
| 224 | pointer. | ||
| 225 | .Pp | ||
| 226 | .Fn X509_PUBKEY_set0_param | ||
| 227 | sets the public key parameters of | ||
| 228 | .Fa pub . | ||
| 229 | The OID associated with the algorithm is set to | ||
| 230 | .Fa aobj . | ||
| 231 | The type of the algorithm parameters is set to | ||
| 232 | .Fa ptype | ||
| 233 | using the structure | ||
| 234 | .Fa pval . | ||
| 235 | The encoding of the public key itself is set to the | ||
| 236 | .Fa penclen | ||
| 237 | bytes contained in buffer | ||
| 238 | .Fa penc . | ||
| 239 | On success ownership of all the supplied parameters is passed to | ||
| 240 | .Fa pub | ||
| 241 | so they must not be freed after the call. | ||
| 242 | .Pp | ||
| 243 | .Fn X509_PUBKEY_get0_param | ||
| 244 | retrieves the public key parameters from | ||
| 245 | .Fa pub , | ||
| 246 | .Pf * Fa ppkalg | ||
| 247 | is set to the associated OID and the encoding consists of | ||
| 248 | .Pf * Fa ppklen | ||
| 249 | bytes at | ||
| 250 | .Pf * Fa pk , | ||
| 251 | and | ||
| 252 | .Pf * Fa pa | ||
| 253 | is set to the associated | ||
| 254 | .Vt AlgorithmIdentifier | ||
| 255 | for the public key. | ||
| 256 | If the value of any of these parameters is not required, | ||
| 257 | it can be set to | ||
| 258 | .Dv NULL . | ||
| 259 | All of the retrieved pointers are internal and must not be freed after | ||
| 260 | the call. | ||
| 261 | .Sh RETURN VALUES | ||
| 262 | If the allocation fails, | ||
| 263 | .Fn X509_PUBKEY_new | ||
| 264 | returns | ||
| 265 | .Dv NULL | ||
| 266 | and sets an error code that can be obtained by | ||
| 267 | .Xr ERR_get_error 3 . | ||
| 268 | Otherwise it returns a pointer to the newly allocated structure. | ||
| 269 | .Pp | ||
| 270 | .Fn X509_PUBKEY_get0 , | ||
| 271 | .Fn X509_PUBKEY_get , | ||
| 272 | .Fn d2i_PUBKEY , | ||
| 273 | .Fn d2i_PUBKEY_bio , | ||
| 274 | and | ||
| 275 | .Fn d2i_PUBKEY_fp | ||
| 276 | return a pointer to an | ||
| 277 | .Vt EVP_PKEY | ||
| 278 | structure or | ||
| 279 | .Dv NULL | ||
| 280 | if an error occurs. | ||
| 281 | .Pp | ||
| 282 | .Fn i2d_PUBKEY | ||
| 283 | returns the number of bytes successfully encoded or a negative value | ||
| 284 | if an error occurs. | ||
| 285 | .Pp | ||
| 286 | .Fn X509_PUBKEY_set , | ||
| 287 | .Fn X509_PUBKEY_set0_param , | ||
| 288 | .Fn X509_PUBKEY_get0_param , | ||
| 289 | .Fn i2d_PUBKEY_fp , | ||
| 290 | and | ||
| 291 | .Fn i2d_PUBKEY_bio | ||
| 292 | return 1 for success and 0 if an error occurred. | ||
| 293 | .Sh ERRORS | ||
| 294 | After failure of | ||
| 295 | .Fn X509_PUBKEY_get0 | ||
| 296 | or | ||
| 297 | .Fn X509_PUBKEY_get , | ||
| 298 | one of the following diagnostics can be retrieved with | ||
| 299 | .Xr ERR_get_error 3 , | ||
| 300 | .Xr ERR_GET_REASON 3 , | ||
| 301 | and | ||
| 302 | .Xr ERR_reason_error_string 3 : | ||
| 303 | .Bl -tag -width Ds | ||
| 304 | .It Dv X509_R_UNSUPPORTED_ALGORITHM Qq "unsupported algorithm" | ||
| 305 | The public key uses an algorithm unsupported by | ||
| 306 | .Xr EVP_PKEY_set_type 3 . | ||
| 307 | .It X509_R_METHOD_NOT_SUPPORTED Qq "method not supported" | ||
| 308 | While the algorithm is known to | ||
| 309 | .Xr EVP_PKEY_set_type 3 , | ||
| 310 | using it for decoding is not supported. | ||
| 311 | .It X509_R_PUBLIC_KEY_DECODE_ERROR Qq "public key decode error" | ||
| 312 | Decoding the public key failed. | ||
| 313 | .It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure" | ||
| 314 | Memory was exhausted when trying to allocate the new | ||
| 315 | .Vt EVP_PKEY | ||
| 316 | object. | ||
| 317 | .El | ||
| 318 | .Pp | ||
| 319 | If | ||
| 320 | .Fa key | ||
| 321 | is | ||
| 322 | .Dv NULL | ||
| 323 | or does not contain a public key, | ||
| 324 | these functions fail but no error is pushed onto the stack. | ||
| 325 | .Sh SEE ALSO | ||
| 326 | .Xr d2i_X509 3 , | ||
| 327 | .Xr EVP_PKEY_asn1_set_public 3 , | ||
| 328 | .Xr X509_ALGOR_new 3 , | ||
| 329 | .Xr X509_get_pubkey 3 , | ||
| 330 | .Xr X509_new 3 | ||
| 331 | .Sh STANDARDS | ||
| 332 | RFC 5280: Internet X.509 Public Key Infrastructure Certificate and | ||
| 333 | Certificate Revocation List (CRL) Profile | ||
| 334 | .Sh HISTORY | ||
| 335 | .Fn X509_PUBKEY_new | ||
| 336 | and | ||
| 337 | .Fn X509_PUBKEY_free | ||
| 338 | appeared in SSLeay 0.4 or earlier. | ||
| 339 | .Fn X509_PUBKEY_set | ||
| 340 | and | ||
| 341 | .Fn X509_PUBKEY_get | ||
| 342 | first appeared in SSLeay 0.8.0. | ||
| 343 | These functions have been available since | ||
| 344 | .Ox 2.4 . | ||
| 345 | .Pp | ||
| 346 | .Fn d2i_PUBKEY | ||
| 347 | and | ||
| 348 | .Fn i2d_PUBKEY | ||
| 349 | first appeared in OpenSSL 0.9.5 and have been available since | ||
| 350 | .Ox 2.7 . | ||
| 351 | .Pp | ||
| 352 | .Fn d2i_PUBKEY_bio , | ||
| 353 | .Fn d2i_PUBKEY_fp , | ||
| 354 | .Fn i2d_PUBKEY_fp , | ||
| 355 | and | ||
| 356 | .Fn i2d_PUBKEY_bio | ||
| 357 | first appeared in OpenSSL 0.9.6 and have been available since | ||
| 358 | .Ox 2.9 . | ||
| 359 | .Pp | ||
| 360 | .Fn X509_PUBKEY_set0_param | ||
| 361 | and | ||
| 362 | .Fn X509_PUBKEY_get0_param | ||
| 363 | first appeared in OpenSSL 1.0.0 and have been available since | ||
| 364 | .Ox 4.9 . | ||
| 365 | .Pp | ||
| 366 | .Fn X509_PUBKEY_get0 | ||
| 367 | first appeared in OpenSSL 1.1.0 and has been available since | ||
| 368 | .Ox 6.3 . | ||
