1gnutls_certificate_set_x509_key_file(g3n)utglnsutls_certificate_set_x509_key_file(3)
2
3
4
6 gnutls_certificate_set_x509_key_file - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_certificate_set_x509_key_file(gnutls_certificate_creden‐
12 tials_t res, const char * certfile, const char * keyfile,
13 gnutls_x509_crt_fmt_t type);
14
16 gnutls_certificate_credentials_t res
17 is a gnutls_certificate_credentials_t type.
18
19 const char * certfile
20 is a file that containing the certificate list (path) for
21 the specified private key, in PKCS7 format, or a list of
22 certificates
23
24 const char * keyfile
25 is a file that contains the private key
26
27 gnutls_x509_crt_fmt_t type
28 is PEM or DER
29
31 This function sets a certificate/private key pair in the gnutls_cer‐
32 tificate_credentials_t type. This function may be called more than
33 once, in case multiple keys/certificates exist for the server. For
34 clients that need to send more than its own end entity certificate,
35 e.g., also an intermediate CA cert, then the
36 certfile must contain the ordered certificate chain.
37
38 Note that the names in the certificate provided will be considered when
39 selecting the appropriate certificate to use (in case of multiple cer‐
40 tificate/key pairs).
41
42 This function can also accept URLs at keyfile and certfile . In that
43 case it will use the private key and certificate indicated by the URLs.
44 Note that the supported URLs are the ones indicated by
45 gnutls_url_is_supported().
46
47 In case the certfile is provided as a PKCS 11 URL, then the certifi‐
48 cate, and its present issuers in the token are imported (i.e., forming
49 the required trust chain).
50
51 If that function fails to load the res structure is at an undefined
52 state, it must not be reused to load other keys or certificates.
53
54 Note that, this function by default returns zero on success and a nega‐
55 tive value on error. Since 3.5.6, when the flag GNUTLS_CERTIFI‐
56 CATE_API_V2 is set using gnutls_certificate_set_flags() it returns an
57 index (greater or equal to zero). That index can be used to other func‐
58 tions to refer to the added key-pair.
59
61 On success this functions returns zero, and otherwise a negative value
62 on error (see above for modifying that behavior).
63
65 3.1.11
66
68 Report bugs to <bugs@gnutls.org>.
69 Home page: http://www.gnutls.org
70
71
73 Copyright © 2001-2018 Free Software Foundation, Inc., and others.
74 Copying and distribution of this file, with or without modification,
75 are permitted in any medium without royalty provided the copyright
76 notice and this notice are preserved.
77
79 The full documentation for gnutls is maintained as a Texinfo manual.
80 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
81 visit
82
83 http://www.gnutls.org/manual/
84
85gnutls 3.6g.n5utls_certificate_set_x509_key_file(3)