From aae6590ce5287076404e5ed0d6709d2496fe499a Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 28 Dec 2016 00:55:06 +0000 Subject: Write new manual page d2i_PKCS8_PRIV_KEY_INFO(3) from scratch. These six function are listed in and in OpenSSL doc/man3/d2i_X509.pod. --- lib/libcrypto/man/Makefile | 3 +- lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 | 114 ++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile index 0e8d4dde50a..b9a647c38e0 100644 --- a/lib/libcrypto/man/Makefile +++ b/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.105 2016/12/27 22:06:55 schwarze Exp $ +# $OpenBSD: Makefile,v 1.106 2016/12/28 00:55:05 schwarze Exp $ .include @@ -236,6 +236,7 @@ MAN= \ d2i_OCSP_RESPONSE.3 \ d2i_PKCS12.3 \ d2i_PKCS7.3 \ + d2i_PKCS8_PRIV_KEY_INFO.3 \ d2i_PKCS8PrivateKey_bio.3 \ d2i_PrivateKey.3 \ d2i_RSAPublicKey.3 \ diff --git a/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 b/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 new file mode 100644 index 00000000000..2ee7d807dfd --- /dev/null +++ b/lib/libcrypto/man/d2i_PKCS8_PRIV_KEY_INFO.3 @@ -0,0 +1,114 @@ +.\" $OpenBSD: d2i_PKCS8_PRIV_KEY_INFO.3,v 1.1 2016/12/28 00:55:05 schwarze Exp $ +.\" +.\" Copyright (c) 2016 Ingo Schwarze +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: December 28 2016 $ +.Dt D2I_PKCS8_PRIV_KEY_INFO 3 +.Os +.Sh NAME +.Nm d2i_PKCS8_PRIV_KEY_INFO , +.Nm i2d_PKCS8_PRIV_KEY_INFO , +.Nm d2i_PKCS8_PRIV_KEY_INFO_bio , +.Nm i2d_PKCS8_PRIV_KEY_INFO_bio , +.Nm d2i_PKCS8_PRIV_KEY_INFO_fp , +.Nm i2d_PKCS8_PRIV_KEY_INFO_fp +.Nd decode and encode PKCS#8 private key +.Sh SYNOPSIS +.In openssl/x509.h +.Ft PKCS8_PRIV_KEY_INFO * +.Fo d2i_PKCS8_PRIV_KEY_INFO +.Fa "PKCS8_PRIV_KEY_INFO **val_out" +.Fa "const unsigned char **der_in" +.Fa "long length" +.Fc +.Ft int +.Fo i2d_PKCS8_PRIV_KEY_INFO +.Fa "PKCS8_PRIV_KEY_INFO *val_in" +.Fa "unsigned char **der_out" +.Fc +.Ft PKCS8_PRIV_KEY_INFO * +.Fo d2i_PKCS8_PRIV_KEY_INFO_bio +.Fa "BIO *in_bio" +.Fa "PKCS8_PRIV_KEY_INFO **val_out" +.Fc +.Ft int +.Fo i2d_PKCS8_PRIV_KEY_INFO_bio +.Fa "BIO *out_bio" +.Fa "PKCS8_PRIV_KEY_INFO *val_in" +.Fc +.Ft PKCS8_PRIV_KEY_INFO * +.Fo d2i_PKCS8_PRIV_KEY_INFO_fp +.Fa "FILE *in_fp" +.Fa "PKCS8_PRIV_KEY_INFO **val_out" +.Fc +.Ft int +.Fo i2d_PKCS8_PRIV_KEY_INFO_fp +.Fa "BIO *out_fp" +.Fa "PKCS8_PRIV_KEY_INFO *val_in" +.Fc +.Sh DESCRIPTION +.Fn d2i_PKCS8_PRIV_KEY_INFO +and +.Fn i2d_PKCS8_PRIV_KEY_INFO +decode and encode an ASN.1 +.Vt PrivateKeyInfo +structure defined in RFC 5208 section 5. +.Pp +.Fn d2i_PKCS8_PRIV_KEY_INFO_bio , +.Fn i2d_PKCS8_PRIV_KEY_INFO_bio , +.Fn d2i_PKCS8_PRIV_KEY_INFO_fp , +and +.Fn i2d_PKCS8_PRIV_KEY_INFO_fp +are similar except that they decode or encode using a +.Vt BIO +or +.Vt FILE +pointer. +.Pp +For details about the semantics, examples, caveats, and bugs, see +.Xr ASN1_item_d2i 3 . +.Pp +These functions all use unencrypted DER format. +To store private keys in encrypted form, consider +.Xr d2i_PKCS8PrivateKey_bio 3 +or +.Xr PEM_write_PKCS8PrivateKey 3 . +.Sh RETURN VALUES +.Fn d2i_PKCS8_PRIV_KEY_INFO , +.Fn d2i_PKCS8_PRIV_KEY_INFO_bio , +and +.Fn d2i_PKCS8_PRIV_KEY_INFO_fp +return a +.Vt PKCS8_PRIV_KEY_INFO +object or +.Dv NULL +if an error occurs. +.Pp +.Fn i2d_PKCS8_PRIV_KEY_INFO +returns the number of bytes successfully encoded or a negative value +if an error occurs. +.Pp +.Fn i2d_PKCS8_PRIV_KEY_INFO_bio +and +.Fn i2d_PKCS8_PRIV_KEY_INFO_fp +return 1 for success or 0 if an error occurs. +.Sh SEE ALSO +.Xr ASN1_item_d2i 3 , +.Xr d2i_PKCS8PrivateKey_bio 3 , +.Xr d2i_PrivateKey 3 , +.Xr PEM_write_PKCS8_PRIV_KEY_INFO 3 , +.Xr PKCS8_PRIV_KEY_INFO_new 3 +.Sh STANDARDS +RFC 5208: PKCS#8: Private-Key Information Syntax Specification -- cgit v1.2.3