1gnutls_certificate_verify_peers(3) gnutls gnutls_certificate_verify_peers(3)
2
3
4
6 gnutls_certificate_verify_peers - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_certificate_verify_peers(gnutls_session_t session,
12 gnutls_typed_vdata_st * data, unsigned int elements, unsigned int *
13 status);
14
16 gnutls_session_t session
17 is a gnutls session
18
19 gnutls_typed_vdata_st * data
20 an array of typed data
21
22 unsigned int elements
23 the number of data elements
24
25 unsigned int * status
26 is the output of the verification
27
29 This function will verify the peer's certificate and store the the sta‐
30 tus in the status variable as a bitwise OR of gnutls_certificate_sta‐
31 tus_t values or zero if the certificate is trusted. Note that value in
32 status is set only when the return value of this function is success
33 (i.e, failure to trust a certificate does not imply a negative return
34 value). The default verification flags used by this function can be
35 overridden using gnutls_certificate_set_verify_flags(). See the docu‐
36 mentation of gnutls_certificate_verify_peers2() for details in the ver‐
37 ification process.
38
39 This function will take into account the stapled OCSP responses sent by
40 the server, as well as the following X.509 certificate extensions: Name
41 Constraints, Key Usage, and Basic Constraints (pathlen).
42
43 The acceptable data types are GNUTLS_DT_DNS_HOSTNAME,
44 GNUTLS_DT_RFC822NAME and GNUTLS_DT_KEY_PURPOSE_OID. The former two
45 accept as data a null-terminated hostname or email address, and the
46 latter a null-terminated object identifier (e.g.,
47 GNUTLS_KP_TLS_WWW_SERVER).
48
49 If a DNS hostname is provided then this function will compare the host‐
50 name in the certificate against the given. If names do not match the
51 GNUTLS_CERT_UNEXPECTED_OWNER status flag will be set. If a key purpose
52 OID is provided and the end-certificate contains the extended key usage
53 PKIX extension, it will be required to be have the provided key purpose
54 or be marked for any purpose, otherwise verification status will have
55 the GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE flag set.
56
57 To avoid denial of service attacks some default upper limits regarding
58 the certificate key size and chain size are set. To override them use
59 gnutls_certificate_set_verify_limits().
60
61 Note that when using raw public-keys verification will not work because
62 there is no corresponding certificate body belonging to the raw key
63 that can be verified. In that case this function will return
64 GNUTLS_E_INVALID_REQUEST.
65
67 GNUTLS_E_SUCCESS (0) when the validation is performed, or a negative
68 error code otherwise. A successful error code means that the status
69 parameter must be checked to obtain the validation status.
70
72 3.3.0
73
75 Report bugs to <bugs@gnutls.org>.
76 Home page: https://www.gnutls.org
77
78
80 Copyright © 2001-2019 Free Software Foundation, Inc., and others.
81 Copying and distribution of this file, with or without modification,
82 are permitted in any medium without royalty provided the copyright
83 notice and this notice are preserved.
84
86 The full documentation for gnutls is maintained as a Texinfo manual.
87 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
88 visit
89
90 https://www.gnutls.org/manual/
91
92gnutls 3.6.11 gnutls_certificate_verify_peers(3)