b2i_PVK_bio_ex.pod 2.5 KB

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