From c644ecaf8f2621ab8df368198d6897fabc09db2f Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Wed, 28 Dec 2016 01:38:16 +0000 Subject: Document i2d_PKCS8PrivateKeyInfo_bio(3) and i2d_PKCS8PrivateKeyInfo_fp(3), listed in and in OpenSSL doc/man3/d2i_X509.pod. These functions are very similar to i2d_PrivateKey(3) but very different from i2d_PKCS8PrivateKey_bio(3), that's why they go into this manual page and not into the other one. When the naming was decided, somebody clearly considered too briefly or too long. --- src/lib/libcrypto/man/d2i_PrivateKey.3 | 47 +++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/src/lib/libcrypto/man/d2i_PrivateKey.3 b/src/lib/libcrypto/man/d2i_PrivateKey.3 index 3c5e9f8cc8..caf7479289 100644 --- a/src/lib/libcrypto/man/d2i_PrivateKey.3 +++ b/src/lib/libcrypto/man/d2i_PrivateKey.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: d2i_PrivateKey.3,v 1.4 2016/12/25 20:01:48 schwarze Exp $ +.\" $OpenBSD: d2i_PrivateKey.3,v 1.5 2016/12/28 01:38:16 schwarze Exp $ .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 .\" .\" This file is a derived work. @@ -65,7 +65,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: December 25 2016 $ +.Dd $Mdocdate: December 28 2016 $ .Dt D2I_PRIVATEKEY 3 .Os .Sh NAME @@ -74,6 +74,8 @@ .Nm i2d_PrivateKey , .Nm d2i_PrivateKey_bio , .Nm d2i_PrivateKey_fp , +.Nm i2d_PKCS8PrivateKeyInfo_bio , +.Nm i2d_PKCS8PrivateKeyInfo_fp , .Nm d2i_PublicKey , .Nm i2d_PublicKey .Nd decode and encode EVP_PKEY objects @@ -107,6 +109,16 @@ .Fa "FILE *in_fp" .Fa "EVP_PKEY **val_out" .Fc +.Ft int +.Fo i2d_PKCS8PrivateKeyInfo_bio +.Fa "BIO *out_bio" +.Fa "EVP_PKEY *val_in" +.Fc +.Ft int +.Fo i2d_PKCS8PrivateKeyInfo_fp +.Fa "FILE *out_fp" +.Fa "EVP_PKEY *val_in" +.Fc .Ft EVP_PKEY * .Fo d2i_PublicKey .Fa "int type" @@ -128,7 +140,7 @@ For details about the semantics, examples, caveats, and bugs, see .Fn d2i_PrivateKey decodes a private key using algorithm .Fa type . -It attempts to use any key specific format or the PKCS#8 unencrypted +It attempts to use any algorithm specific format or the PKCS#8 unencrypted .Vt PrivateKeyInfo format defined in RFC 5208 section 5. The @@ -157,11 +169,28 @@ pointer. .Fn i2d_PrivateKey encodes .Fa val_in . -It uses a key specific format or, if none is defined for that key type, -the PKCS#8 unencrypted +It uses an algorithm specific format or, if none is defined for +that key type, the PKCS#8 unencrypted .Vt PrivateKeyInfo format. .Pp +.Fn i2d_PKCS8PrivateKeyInfo_bio +and +.Fn i2d_PKCS8PrivateKeyInfo_fp +encode +.Fa val_in +in PKCS#8 unencrypted +.Vt PrivateKeyInfo +format. +They are similar to +.Fn i2d_PrivateKey +except that they don't use any algorithm-specific formats +and that they write to a +.Vt BIO +or +.Vt FILE +pointer rather than to a buffer. +.Pp All these functions use DER format and unencrypted keys. Applications wishing to encrypt or decrypt private keys should use other functions such as @@ -209,7 +238,7 @@ depending on the algorithm used by and .Fn d2i_PublicKey return a valid -.Vt EVP_KEY +.Vt EVP_PKEY structure or .Dv NULL if an error occurs. @@ -220,9 +249,15 @@ and return the number of bytes successfully encoded or a negative value if an error occurs. .Pp +.Fn i2d_PKCS8PrivateKeyInfo_bio +and +.Fn i2d_PKCS8PrivateKeyInfo_fp +return 1 for success or 0 if an error occurs. +.Pp For all functions, the error code can be obtained by calling .Xr ERR_get_error 3 . .Sh SEE ALSO +.Xr d2i_PKCS8_PRIV_KEY_INFO 3 , .Xr d2i_PKCS8PrivateKey_bio 3 , .Xr EVP_PKEY_type 3 , .Xr PEM_write_PrivateKey 3 , -- cgit v1.2.3-55-g6feb