1gnutls_x509_privkey_export2_pkcs8(3)gnutlsgnutls_x509_privkey_export2_pkcs8(3)
2
3
4
6 gnutls_x509_privkey_export2_pkcs8 - API function
7
9 #include <gnutls/x509.h>
10
11 int gnutls_x509_privkey_export2_pkcs8(gnutls_x509_privkey_t key,
12 gnutls_x509_crt_fmt_t format, const char * password, unsigned int
13 flags, gnutls_datum_t * out);
14
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 gnutls_datum_t * out
29 will contain a private key PEM or DER encoded
30
32 This function will export the private key to a PKCS8 structure. Both
33 RSA and DSA keys can be exported. For DSA keys we use PKCS 11 defini‐
34 tions. If the flags do not specify the encryption cipher, then the
35 default 3DES (PBES2) will be used.
36
37 The password can be either ASCII or UTF-8 in the default PBES2 encryp‐
38 tion schemas, or ASCII for the PKCS12 schemas.
39
40 The output buffer is allocated using gnutls_malloc().
41
42 If the structure is PEM encoded, it will have a header of "BEGIN
43 ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if encryption is not
44 used.
45
47 In case of failure a negative error code will be returned, and 0 on
48 success.
49
50 Since 3.1.3
51
53 Report bugs to <bugs@gnutls.org>.
54 Home page: http://www.gnutls.org
55
56
58 Copyright © 2001-2018 Free Software Foundation, Inc., and others.
59 Copying and distribution of this file, with or without modification,
60 are permitted in any medium without royalty provided the copyright
61 notice and this notice are preserved.
62
64 The full documentation for gnutls is maintained as a Texinfo manual.
65 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
66 visit
67
68 http://www.gnutls.org/manual/
69
70gnutls 3.6.5gnutls_x509_privkey_export2_pkcs8(3)