1gnutls_x509_privkey_import_pkcs8(3) gnutls gnutls_x509_privkey_import_pkcs8(3)
2
3
4
6 gnutls_x509_privkey_import_pkcs8 - API function
7
9 #include <gnutls/x509.h>
10
11 int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey_t key, const
12 gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, const char * pass‐
13 word, unsigned int flags);
14
16 gnutls_x509_privkey_t key
17 The data to store the parsed key
18
19 const gnutls_datum_t * data
20 The DER or PEM encoded key.
21
22 gnutls_x509_crt_fmt_t format
23 One of DER or PEM
24
25 const char * password
26 the password to decrypt the key (if it is encrypted).
27
28 unsigned int flags
29 0 if encrypted or GNUTLS_PKCS_PLAIN if not encrypted.
30
32 This function will convert the given DER or PEM encoded PKCS8 2.0 en‐
33 crypted key to the native gnutls_x509_privkey_t format. The output will
34 be stored in key . Both RSA and DSA keys can be imported, and flags
35 can only be used to indicate an unencrypted key.
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 If the Certificate is PEM encoded it should have a header of "ENCRYPTED
41 PRIVATE KEY", or "PRIVATE KEY". You only need to specify the flags if
42 the key is DER encoded, since in that case the encryption status cannot
43 be auto-detected.
44
45 If the GNUTLS_PKCS_PLAIN flag is specified and the supplied data are
46 encrypted then GNUTLS_E_DECRYPTION_FAILED is returned.
47
49 On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative er‐
50 ror value.
51
53 Report bugs to <bugs@gnutls.org>.
54 Home page: https://www.gnutls.org
55
56
58 Copyright © 2001- 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 no‐
61 tice 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 https://www.gnutls.org/manual/
69
70gnutls 3.7.8 gnutls_x509_privkey_import_pkcs8(3)