xref: /freebsd/crypto/openssl/doc/man3/EVP_PKEY2PKCS8.pod (revision aa7957345732816fb0ba8308798d2f79f45597f9)
1b077aed3SPierre Pronchery=pod
2b077aed3SPierre Pronchery
3b077aed3SPierre Pronchery=head1 NAME
4b077aed3SPierre Pronchery
5b077aed3SPierre ProncheryEVP_PKEY2PKCS8, EVP_PKCS82PKEY_ex, EVP_PKCS82PKEY
6b077aed3SPierre Pronchery- Convert a private key to/from PKCS8
7b077aed3SPierre Pronchery
8b077aed3SPierre Pronchery=head1 SYNOPSIS
9b077aed3SPierre Pronchery
10b077aed3SPierre Pronchery #include <openssl/x509.h>
11b077aed3SPierre Pronchery
12b077aed3SPierre Pronchery PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(const EVP_PKEY *pkey);
13b077aed3SPierre Pronchery EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8);
14b077aed3SPierre Pronchery EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx,
15b077aed3SPierre Pronchery                             const char *propq);
16b077aed3SPierre Pronchery
17b077aed3SPierre Pronchery=head1 DESCRIPTION
18b077aed3SPierre Pronchery
19b077aed3SPierre ProncheryEVP_PKEY2PKCS8() converts a private key I<pkey> into a returned PKCS8 object.
20b077aed3SPierre Pronchery
21b077aed3SPierre ProncheryEVP_PKCS82PKEY_ex() converts a PKCS8 object I<p8> into a returned private key.
22b077aed3SPierre ProncheryIt uses I<libctx> and I<propq> when fetching algorithms.
23b077aed3SPierre Pronchery
24*aa795734SPierre ProncheryEVP_PKCS82PKEY() is similar to EVP_PKCS82PKEY_ex() but uses default values of
25b077aed3SPierre ProncheryNULL for the I<libctx> and I<propq>.
26b077aed3SPierre Pronchery
27b077aed3SPierre Pronchery=head1 RETURN VALUES
28b077aed3SPierre Pronchery
29b077aed3SPierre ProncheryEVP_PKEY2PKCS8() returns a PKCS8 object on success.
30b077aed3SPierre ProncheryEVP_PKCS82PKEY() and EVP_PKCS82PKEY_ex() return a private key on success.
31b077aed3SPierre Pronchery
32b077aed3SPierre ProncheryAll functions return NULL if the operation fails.
33b077aed3SPierre Pronchery
34b077aed3SPierre Pronchery=head1 SEE ALSO
35b077aed3SPierre Pronchery
36b077aed3SPierre ProncheryL<PKCS8_pkey_add1_attr(3)>,
37b077aed3SPierre Pronchery
38b077aed3SPierre Pronchery=head1 COPYRIGHT
39b077aed3SPierre Pronchery
40*aa795734SPierre ProncheryCopyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
41b077aed3SPierre Pronchery
42b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
43b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
44b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
45b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
46b077aed3SPierre Pronchery
47b077aed3SPierre Pronchery=cut
48