1gnutls_credentials_set(3) gnutls gnutls_credentials_set(3)
2
3
4
6 gnutls_credentials_set - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_credentials_set(gnutls_session_t session, gnutls_creden‐
12 tials_type_t type, void * cred);
13
15 gnutls_session_t session
16 is a gnutls_session_t type.
17
18 gnutls_credentials_type_t type
19 is the type of the credentials
20
21 void * cred the credentials to set
22
24 Sets the needed credentials for the specified type. E.g. username,
25 password - or public and private keys etc. The cred parameter is a
26 structure that depends on the specified type and on the current session
27 (client or server).
28
29 In order to minimize memory usage, and share credentials between sev‐
30 eral threads gnutls keeps a pointer to cred, and not the whole cred
31 structure. Thus you will have to keep the structure allocated until
32 you call gnutls_deinit().
33
34 For GNUTLS_CRD_ANON, cred should be gnutls_anon_client_credentials_t
35 in case of a client. In case of a server it should be
36 gnutls_anon_server_credentials_t.
37
38 For GNUTLS_CRD_SRP, cred should be gnutls_srp_client_credentials_t in
39 case of a client, and gnutls_srp_server_credentials_t, in case of a
40 server.
41
42 For GNUTLS_CRD_CERTIFICATE, cred should be gnutls_certificate_creden‐
43 tials_t.
44
46 On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative er‐
47 ror code is returned.
48
50 Report bugs to <bugs@gnutls.org>.
51 Home page: https://www.gnutls.org
52
53
55 Copyright © 2001- Free Software Foundation, Inc., and others.
56 Copying and distribution of this file, with or without modification,
57 are permitted in any medium without royalty provided the copyright no‐
58 tice and this notice are preserved.
59
61 The full documentation for gnutls is maintained as a Texinfo manual.
62 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
63 visit
64
65 https://www.gnutls.org/manual/
66
67gnutls 3.7.8 gnutls_credentials_set(3)