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