1gnutls_certificate_set_retrieve_fungcntguintoulnts2l_(sc3e)rtificate_set_retrieve_function2(3)
2
3
4
6 gnutls_certificate_set_retrieve_function2 - API function
7
9 #include <gnutls/abstract.h>
10
11 void gnutls_certificate_set_retrieve_function2(gnutls_certificate_cre‐
12 dentials_t cred, gnutls_certificate_retrieve_function2 * func);
13
15 gnutls_certificate_credentials_t cred
16 is a gnutls_certificate_credentials_t type.
17
18 gnutls_certificate_retrieve_function2 * func
19 is the callback function
20
22 This function sets a callback to be called in order to retrieve the
23 certificate to be used in the handshake. The callback will take control
24 only if a certificate is requested by the peer.
25
26 The callback's function prototype is: int (*callback)(gnutls_session_t,
27 const gnutls_datum_t* req_ca_dn, int nreqs, const gnutls_pk_algo‐
28 rithm_t* pk_algos, int pk_algos_length, gnutls_pcert_st** pcert, un‐
29 signed int *pcert_length, gnutls_privkey_t * pkey);
30
31 req_ca_dn is only used in X.509 certificates. Contains a list with
32 the CA names that the server considers trusted. This is a hint and
33 typically the client should send a certificate that is signed by one of
34 these CAs. These names, when available, are DER encoded. To get a more
35 meaningful value use the function gnutls_x509_rdn_get().
36
37 pk_algos contains a list with server's acceptable public key algo‐
38 rithms. The certificate returned should support the server's given al‐
39 gorithms.
40
41 pcert should contain a single certificate and public key or a list of
42 them.
43
44 pcert_length is the size of the previous list.
45
46 pkey is the private key.
47
48 If the callback function is provided then gnutls will call it, in the
49 handshake, after the certificate request message has been received.
50 All the provided by the callback values will not be released or modi‐
51 fied by gnutls.
52
53 In server side pk_algos and req_ca_dn are NULL.
54
55 The callback function should set the certificate list to be sent, and
56 return 0 on success. If no certificate was selected then the number of
57 certificates should be set to zero. The value (-1) indicates error and
58 the handshake will be terminated. If both certificates are set in the
59 credentials and a callback is available, the callback takes predence.
60
62 3.0
63
65 Report bugs to <bugs@gnutls.org>.
66 Home page: https://www.gnutls.org
67
68
70 Copyright © 2001-2023 Free Software Foundation, Inc., and others.
71 Copying and distribution of this file, with or without modification,
72 are permitted in any medium without royalty provided the copyright no‐
73 tice and this notice are preserved.
74
76 The full documentation for gnutls is maintained as a Texinfo manual.
77 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
78 visit
79
80 https://www.gnutls.org/manual/
81
82gnutls gnu3t.l8s._2certificate_set_retrieve_function2(3)