1gnutls_certificate_set_x509_key_mem2(g3n)utglnsutls_certificate_set_x509_key_mem2(3)
2
3
4
6 gnutls_certificate_set_x509_key_mem2 - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_certificate_set_x509_key_mem2(gnutls_certificate_creden‐
12 tials_t res, const gnutls_datum_t * cert, const gnutls_datum_t * key,
13 gnutls_x509_crt_fmt_t type, const char * pass, unsigned int flags);
14
16 gnutls_certificate_credentials_t res
17 is a gnutls_certificate_credentials_t type.
18
19 const gnutls_datum_t * cert
20 contains a certificate list (path) for the specified pri‐
21 vate key
22
23 const gnutls_datum_t * key
24 is the private key, or NULL
25
26 gnutls_x509_crt_fmt_t type
27 is PEM or DER
28
29 const char * pass
30 is the key's password
31
32 unsigned int flags
33 an ORed sequence of gnutls_pkcs_encrypt_flags_t
34
36 This function sets a certificate/private key pair in the gnutls_cer‐
37 tificate_credentials_t type. This function may be called more than
38 once, in case multiple keys/certificates exist for the server.
39
40 Note that the keyUsage (2.5.29.15) PKIX extension in X.509 certificates
41 is supported. This means that certificates intended for signing cannot
42 be used for ciphersuites that require encryption.
43
44 If the certificate and the private key are given in PEM encoding then
45 the strings that hold their values must be null terminated.
46
47 The key may be NULL if you are using a sign callback, see
48 gnutls_sign_callback_set().
49
50 Note that, this function by default returns zero on success and a nega‐
51 tive value on error. Since 3.5.6, when the flag GNUTLS_CERTIFI‐
52 CATE_API_V2 is set using gnutls_certificate_set_flags() it returns an
53 index (greater or equal to zero). That index can be used to other func‐
54 tions to refer to the added key-pair.
55
57 On success this functions returns zero, and otherwise a negative value
58 on error (see above for modifying that behavior).
59
61 Report bugs to <bugs@gnutls.org>.
62 Home page: https://www.gnutls.org
63
64
66 Copyright © 2001- Free Software Foundation, Inc., and others.
67 Copying and distribution of this file, with or without modification,
68 are permitted in any medium without royalty provided the copyright
69 notice and this notice are preserved.
70
72 The full documentation for gnutls is maintained as a Texinfo manual.
73 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
74 visit
75
76 https://www.gnutls.org/manual/
77
78gnutls 3.6.g1n5utls_certificate_set_x509_key_mem2(3)