1gnutls_x509_privkey_export_pkcs8(3) gnutls gnutls_x509_privkey_export_pkcs8(3)
2
3
4

NAME

6       gnutls_x509_privkey_export_pkcs8 - API function
7

SYNOPSIS

9       #include <gnutls/x509.h>
10
11       int     gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t     key,
12       gnutls_x509_crt_fmt_t format,  const  char  *  password,  unsigned  int
13       flags, void * output_data, size_t * output_data_size);
14

ARGUMENTS

16       gnutls_x509_privkey_t key
17                   Holds the key
18
19       gnutls_x509_crt_fmt_t format
20                   the format of output params. One of PEM or DER.
21
22       const char * password
23                   the password that will be used to encrypt the key.
24
25       unsigned int flags
26                   an ORed sequence of gnutls_pkcs_encrypt_flags_t
27
28       void * output_data
29                   will contain a private key PEM or DER encoded
30
31       size_t * output_data_size
32                   holds  the size of output_data (and will be replaced by the
33                   actual size of parameters)
34

DESCRIPTION

36       This function will export the private key to a PKCS8  structure.   Both
37       RSA  and  DSA keys can be exported. For DSA keys we use PKCS 11 defini‐
38       tions. If the flags do not specify the encryption cipher, then the  de‐
39       fault 3DES (PBES2) will be used.
40
41       The  password can be either ASCII or UTF-8 in the default PBES2 encryp‐
42       tion schemas, or ASCII for the PKCS12 schemas.
43
44       If the buffer provided is not long enough  to  hold  the  output,  then
45       *output_data_size  is  updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be
46       returned.
47
48       If the structure is PEM encoded, it will have a header  of  "BEGIN  EN‐
49       CRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if encryption is not used.
50

RETURNS

52       In  case  of  failure  a negative error code will be returned, and 0 on
53       success.
54

REPORTING BUGS

56       Report bugs to <bugs@gnutls.org>.
57       Home page: https://www.gnutls.org
58
59
61       Copyright © 2001-2023 Free Software Foundation, Inc., and others.
62       Copying and distribution of this file, with  or  without  modification,
63       are  permitted in any medium without royalty provided the copyright no‐
64       tice and this notice are preserved.
65

SEE ALSO

67       The full documentation for gnutls is maintained as  a  Texinfo  manual.
68       If  the /usr/share/doc/gnutls/ directory does not contain the HTML form
69       visit
70
71       https://www.gnutls.org/manual/
72
73gnutls                               3.8.2 gnutls_x509_privkey_export_pkcs8(3)
Impressum