1gnutls_certificate_set_key(3)       gnutls       gnutls_certificate_set_key(3)
2
3
4

NAME

6       gnutls_certificate_set_key - API function
7

SYNOPSIS

9       #include <gnutls/abstract.h>
10
11       int   gnutls_certificate_set_key(gnutls_certificate_credentials_t  res,
12       const char ** names, int names_size, gnutls_pcert_st * pcert_list,  int
13       pcert_list_size, gnutls_privkey_t key);
14

ARGUMENTS

16       gnutls_certificate_credentials_t res
17                   is a gnutls_certificate_credentials_t type.
18
19       const char ** names
20                   is  an array of DNS names belonging to the public-key (NULL
21                   if none)
22
23       int names_size
24                   holds the size of the names list
25
26       gnutls_pcert_st * pcert_list
27                   contains a certificate list (chain) or raw public-key
28
29       int pcert_list_size
30                   holds the size of the certificate list
31
32       gnutls_privkey_t key
33                   is a gnutls_privkey_t key corresponding to the  first  pub‐
34                   lic-key in pcert_list
35

DESCRIPTION

37       This  function  sets  a  public/private key pair in the gnutls_certifi‐
38       cate_credentials_t type. The given public key may be encapsulated in  a
39       certificate  or  can be given as a raw key. This function may be called
40       more than once, in case multiple key pairs exist for  the  server.  For
41       clients  that  want to send more than their own end- entity certificate
42       (e.g., also an intermediate CA cert), the full certificate  chain  must
43       be provided in  pcert_list .
44
45       Note  that  the   key will become part of the credentials structure and
46       must not be deallocated. It will be automatically deallocated when  the
47       res structure is deinitialized.
48
49       If this function fails, the  res structure is at an undefined state and
50       it must not be reused to load other keys or certificates.
51
52       Note that, this function by default returns zero on success and a nega‐
53       tive  value  on  error.   Since  3.5.6,  when  the flag GNUTLS_CERTIFI‐
54       CATE_API_V2 is set using gnutls_certificate_set_flags() it  returns  an
55       index  (greater  or  equal  to  zero). That index can be used for other
56       functions to refer to the added key-pair.
57
58       Since GnuTLS 3.6.6 this function also handles raw public keys.
59

RETURNS

61       On success this functions returns zero, and otherwise a negative  value
62       on error (see above for modifying that behavior).
63

SINCE

65       3.0
66

REPORTING BUGS

68       Report bugs to <bugs@gnutls.org>.
69       Home page: https://www.gnutls.org
70
71
73       Copyright © 2001-2019 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

SEE ALSO

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       https://www.gnutls.org/manual/
84
85gnutls                               3.6.8       gnutls_certificate_set_key(3)
Impressum