5 b2i_PVK_bio, b2i_PVK_bio_ex, i2b_PVK_bio, i2b_PVK_bio_ex - Decode and encode
6 functions for reading and writing MSBLOB format private keys
10 #include <openssl/pem.h>
12 EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
13 EVP_PKEY *b2i_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u,
14 OSSL_LIB_CTX *libctx, const char *propq);
15 int i2b_PVK_bio(BIO *out, const EVP_PKEY *pk, int enclevel,
16 pem_password_cb *cb, void *u);
17 int i2b_PVK_bio_ex(BIO *out, const EVP_PKEY *pk, int enclevel,
18 pem_password_cb *cb, void *u,
19 OSSL_LIB_CTX *libctx, const char *propq);
23 b2i_PVK_bio_ex() decodes a private key of MSBLOB format read from a B<BIO>. It
24 attempts to automatically determine the key type. If the key is encrypted then
25 I<cb> is called with the user data I<u> in order to obtain a password to decrypt
26 the key. The supplied library context I<libctx> and property query
27 string I<propq> are used in any decrypt operation.
29 b2i_PVK_bio() does the same as b2i_PVK_bio_ex() except that the default
30 library context and property query string are used.
32 i2b_PVK_bio_ex() encodes I<pk> using MSBLOB format. If I<enclevel> is 1 then
33 a password obtained via I<pem_password_cb> is used to encrypt the private key.
34 If I<enclevel> is 0 then no encryption is applied. The user data in I<u> is
35 passed to the password callback. The supplied library context I<libctx> and
36 property query string I<propq> are used in any decrypt operation.
38 i2b_PVK_bio() does the same as i2b_PVK_bio_ex() except that the default
39 library context and property query string are used.
43 The b2i_PVK_bio() and b2i_PVK_bio_ex() functions return a valid B<EVP_KEY>
44 structure or B<NULL> if an error occurs. The error code can be obtained by calling
47 i2b_PVK_bio() and i2b_PVK_bio_ex() return the number of bytes successfully
48 encoded or a negative value if an error occurs. The error code can be obtained
49 by calling L<ERR_get_error(3)>.
54 L<d2i_PKCS8PrivateKey_bio(3)>
58 b2i_PVK_bio_ex() and i2b_PVK_bio_ex() were added in OpenSSL 3.0.
62 Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
64 Licensed under the Apache License 2.0 (the "License"). You may not use
65 this file except in compliance with the License. You can obtain a copy
66 in the file LICENSE in the source distribution or at
67 L<https://www.openssl.org/source/license.html>.