2 * Copyright (C) 2001-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 /* Some of the stuff needed for Certificate authentication is contained
27 #include <gnutls_int.h>
28 #include <gnutls_errors.h>
29 #include <auth/cert.h>
30 #include <gnutls_datum.h>
31 #include <gnutls_mpi.h>
32 #include <gnutls_global.h>
33 #include <algorithms.h>
34 #include <gnutls_dh.h>
35 #include <gnutls_str.h>
36 #include <gnutls_state.h>
37 #include <gnutls_auth.h>
38 #include <gnutls_x509.h>
39 #include <gnutls_str_array.h>
40 #include "x509/x509_int.h"
42 #include "openpgp/gnutls_openpgp.h"
46 * gnutls_certificate_free_keys:
47 * @sc: is a #gnutls_certificate_credentials_t structure.
49 * This function will delete all the keys and the certificates associated
50 * with the given credentials. This function must not be called when a
51 * TLS negotiation that uses the credentials is in progress.
55 gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc
)
59 for (i
= 0; i
< sc
->ncerts
; i
++)
61 for (j
= 0; j
< sc
->certs
[i
].cert_list_length
; j
++)
63 gnutls_pcert_deinit (&sc
->certs
[i
].cert_list
[j
]);
65 gnutls_free (sc
->certs
[i
].cert_list
);
66 _gnutls_str_array_clear (&sc
->certs
[i
].names
);
69 gnutls_free (sc
->certs
);
72 for (i
= 0; i
< sc
->ncerts
; i
++)
74 gnutls_privkey_deinit (sc
->pkey
[i
]);
77 gnutls_free (sc
->pkey
);
84 * gnutls_certificate_free_cas:
85 * @sc: is a #gnutls_certificate_credentials_t structure.
87 * This function will delete all the CAs associated with the given
88 * credentials. Servers that do not use
89 * gnutls_certificate_verify_peers2() may call this to save some
93 gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc
)
95 /* FIXME: do nothing for now */
100 * gnutls_certificate_get_issuer:
101 * @sc: is a #gnutls_certificate_credentials_t structure.
102 * @cert: is the certificate to find issuer for
103 * @issuer: Will hold the issuer if any. Should be treated as constant.
106 * This function will return the issuer of a given certificate.
108 * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
109 * negative error value.
114 gnutls_certificate_get_issuer (gnutls_certificate_credentials_t sc
,
115 gnutls_x509_crt_t cert
, gnutls_x509_crt_t
* issuer
, unsigned int flags
)
117 return gnutls_x509_trust_list_get_issuer(sc
->tlist
, cert
, issuer
, flags
);
121 * gnutls_certificate_free_ca_names:
122 * @sc: is a #gnutls_certificate_credentials_t structure.
124 * This function will delete all the CA name in the given
125 * credentials. Clients may call this to save some memory since in
126 * client side the CA names are not used. Servers might want to use
127 * this function if a large list of trusted CAs is present and
128 * sending the names of it would just consume bandwidth without providing
129 * information to client.
131 * CA names are used by servers to advertise the CAs they support to
135 gnutls_certificate_free_ca_names (gnutls_certificate_credentials_t sc
)
137 _gnutls_free_datum (&sc
->x509_rdn_sequence
);
141 * _gnutls_certificate_get_rsa_params - Returns the RSA parameters pointer
142 * @rsa_params: holds the RSA parameters or NULL.
143 * @func: function to retrieve the parameters or NULL.
144 * @session: The session.
146 * This function will return the rsa parameters pointer.
149 _gnutls_certificate_get_rsa_params (gnutls_rsa_params_t rsa_params
,
150 gnutls_params_function
* func
,
151 gnutls_session_t session
)
153 gnutls_params_st params
;
156 if (session
->internals
.params
.rsa_params
)
158 return session
->internals
.params
.rsa_params
;
163 session
->internals
.params
.rsa_params
= rsa_params
;
167 ret
= func (session
, GNUTLS_PARAMS_RSA_EXPORT
, ¶ms
);
168 if (ret
== 0 && params
.type
== GNUTLS_PARAMS_RSA_EXPORT
)
170 session
->internals
.params
.rsa_params
= params
.params
.rsa_export
;
171 session
->internals
.params
.free_rsa_params
= params
.deinit
;
175 return session
->internals
.params
.rsa_params
;
180 * gnutls_certificate_free_credentials:
181 * @sc: is a #gnutls_certificate_credentials_t structure.
183 * This structure is complex enough to manipulate directly thus this
184 * helper function is provided in order to free (deallocate) it.
186 * This function does not free any temporary parameters associated
187 * with this structure (ie RSA and DH parameters are not freed by this
191 gnutls_certificate_free_credentials (gnutls_certificate_credentials_t sc
)
193 gnutls_x509_trust_list_deinit(sc
->tlist
, 1);
194 gnutls_certificate_free_keys (sc
);
195 gnutls_certificate_free_ca_names (sc
);
196 gnutls_free(sc
->ocsp_response_file
);
198 #ifdef ENABLE_OPENPGP
199 gnutls_openpgp_keyring_deinit (sc
->keyring
);
207 * gnutls_certificate_allocate_credentials:
208 * @res: is a pointer to a #gnutls_certificate_credentials_t structure.
210 * This structure is complex enough to manipulate directly thus this
211 * helper function is provided in order to allocate it.
213 * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
216 gnutls_certificate_allocate_credentials (gnutls_certificate_credentials_t
*
221 *res
= gnutls_calloc (1, sizeof (certificate_credentials_st
));
224 return GNUTLS_E_MEMORY_ERROR
;
226 ret
= gnutls_x509_trust_list_init( &(*res
)->tlist
, 0);
231 return GNUTLS_E_MEMORY_ERROR
;
233 (*res
)->verify_bits
= DEFAULT_MAX_VERIFY_BITS
;
234 (*res
)->verify_depth
= DEFAULT_MAX_VERIFY_DEPTH
;
235 (*res
)->verify_flags
= GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN
;
241 /* returns the KX algorithms that are supported by a
242 * certificate. (Eg a certificate with RSA params, supports
243 * GNUTLS_KX_RSA algorithm).
244 * This function also uses the KeyUsage field of the certificate
245 * extensions in order to disable unneded algorithms.
248 _gnutls_selected_cert_supported_kx (gnutls_session_t session
,
249 gnutls_kx_algorithm_t
* alg
,
252 gnutls_kx_algorithm_t kx
;
253 gnutls_pk_algorithm_t pk
, cert_pk
;
254 gnutls_pcert_st
*cert
;
257 if (session
->internals
.selected_cert_list_length
== 0)
263 cert
= &session
->internals
.selected_cert_list
[0];
264 cert_pk
= gnutls_pubkey_get_pk_algorithm(cert
->pubkey
, NULL
);
267 for (kx
= 0; kx
< MAX_ALGOS
; kx
++)
269 pk
= _gnutls_map_pk_get_pk (kx
);
272 /* then check key usage */
273 if (_gnutls_check_key_usage (cert
, kx
) == 0)
279 return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR
);
287 return GNUTLS_E_INVALID_REQUEST
;
297 * gnutls_certificate_server_set_request:
298 * @session: is a #gnutls_session_t structure.
299 * @req: is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE
301 * This function specifies if we (in case of a server) are going to
302 * send a certificate request message to the client. If @req is
303 * GNUTLS_CERT_REQUIRE then the server will return an error if the
304 * peer does not provide a certificate. If you do not call this
305 * function then the client will not be asked to send a certificate.
308 gnutls_certificate_server_set_request (gnutls_session_t session
,
309 gnutls_certificate_request_t req
)
311 session
->internals
.send_cert_req
= req
;
315 * gnutls_certificate_client_set_retrieve_function:
316 * @cred: is a #gnutls_certificate_credentials_t structure.
317 * @func: is the callback function
319 * This function sets a callback to be called in order to retrieve the
320 * certificate to be used in the handshake.
321 * You are advised to use gnutls_certificate_set_retrieve_function2() because it
322 * is much more efficient in the processing it requires from gnutls.
324 * The callback's function prototype is:
325 * int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs,
326 * const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr_st* st);
328 * @req_ca_cert is only used in X.509 certificates.
329 * Contains a list with the CA names that the server considers trusted.
330 * Normally we should send a certificate that is signed
331 * by one of these CAs. These names are DER encoded. To get a more
332 * meaningful value use the function gnutls_x509_rdn_get().
334 * @pk_algos contains a list with server's acceptable signature algorithms.
335 * The certificate returned should support the server's given algorithms.
337 * @st should contain the certificates and private keys.
339 * If the callback function is provided then gnutls will call it, in the
340 * handshake, if a certificate is requested by the server (and after the
341 * certificate request message has been received).
343 * The callback function should set the certificate list to be sent,
344 * and return 0 on success. If no certificate was selected then the
345 * number of certificates should be set to zero. The value (-1)
346 * indicates error and the handshake will be terminated.
348 void gnutls_certificate_client_set_retrieve_function
349 (gnutls_certificate_credentials_t cred
,
350 gnutls_certificate_client_retrieve_function
* func
)
352 cred
->client_get_cert_callback
= func
;
356 * gnutls_certificate_server_set_retrieve_function:
357 * @cred: is a #gnutls_certificate_credentials_t structure.
358 * @func: is the callback function
360 * This function sets a callback to be called in order to retrieve the
361 * certificate to be used in the handshake.
362 * You are advised to use gnutls_certificate_set_retrieve_function2() because it
363 * is much more efficient in the processing it requires from gnutls.
365 * The callback's function prototype is:
366 * int (*callback)(gnutls_session_t, gnutls_retr_st* st);
368 * @st should contain the certificates and private keys.
370 * If the callback function is provided then gnutls will call it, in the
371 * handshake, after the certificate request message has been received.
373 * The callback function should set the certificate list to be sent, and
374 * return 0 on success. The value (-1) indicates error and the handshake
375 * will be terminated.
377 void gnutls_certificate_server_set_retrieve_function
378 (gnutls_certificate_credentials_t cred
,
379 gnutls_certificate_server_retrieve_function
* func
)
381 cred
->server_get_cert_callback
= func
;
385 * gnutls_certificate_set_retrieve_function:
386 * @cred: is a #gnutls_certificate_credentials_t structure.
387 * @func: is the callback function
389 * This function sets a callback to be called in order to retrieve the
390 * certificate to be used in the handshake. You are advised
391 * to use gnutls_certificate_set_retrieve_function2() because it
392 * is much more efficient in the processing it requires from gnutls.
394 * The callback's function prototype is:
395 * int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs,
396 * const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr2_st* st);
398 * @req_ca_cert is only used in X.509 certificates.
399 * Contains a list with the CA names that the server considers trusted.
400 * Normally we should send a certificate that is signed
401 * by one of these CAs. These names are DER encoded. To get a more
402 * meaningful value use the function gnutls_x509_rdn_get().
404 * @pk_algos contains a list with server's acceptable signature algorithms.
405 * The certificate returned should support the server's given algorithms.
407 * @st should contain the certificates and private keys.
409 * If the callback function is provided then gnutls will call it, in the
410 * handshake, after the certificate request message has been received.
412 * In server side pk_algos and req_ca_dn are NULL.
414 * The callback function should set the certificate list to be sent,
415 * and return 0 on success. If no certificate was selected then the
416 * number of certificates should be set to zero. The value (-1)
417 * indicates error and the handshake will be terminated.
421 void gnutls_certificate_set_retrieve_function
422 (gnutls_certificate_credentials_t cred
,
423 gnutls_certificate_retrieve_function
* func
)
425 cred
->get_cert_callback
= func
;
429 * gnutls_certificate_set_retrieve_function2:
430 * @cred: is a #gnutls_certificate_credentials_t structure.
431 * @func: is the callback function
433 * This function sets a callback to be called in order to retrieve the
434 * certificate to be used in the handshake.
436 * The callback's function prototype is:
437 * int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs,
438 * const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_pcert_st** pcert,
439 * unsigned int *pcert_length, gnutls_privkey_t * pkey);
441 * @req_ca_cert is only used in X.509 certificates.
442 * Contains a list with the CA names that the server considers trusted.
443 * Normally we should send a certificate that is signed
444 * by one of these CAs. These names are DER encoded. To get a more
445 * meaningful value use the function gnutls_x509_rdn_get().
447 * @pk_algos contains a list with server's acceptable signature algorithms.
448 * The certificate returned should support the server's given algorithms.
450 * @pcert should contain a single certificate and public or a list of them.
452 * @pcert_length is the size of the previous list.
454 * @pkey is the private key.
456 * If the callback function is provided then gnutls will call it, in the
457 * handshake, after the certificate request message has been received.
459 * In server side pk_algos and req_ca_dn are NULL.
461 * The callback function should set the certificate list to be sent,
462 * and return 0 on success. If no certificate was selected then the
463 * number of certificates should be set to zero. The value (-1)
464 * indicates error and the handshake will be terminated.
468 void gnutls_certificate_set_retrieve_function2
469 (gnutls_certificate_credentials_t cred
,
470 gnutls_certificate_retrieve_function2
* func
)
472 cred
->get_cert_callback2
= func
;
476 * gnutls_certificate_set_verify_function:
477 * @cred: is a #gnutls_certificate_credentials_t structure.
478 * @func: is the callback function
480 * This function sets a callback to be called when peer's certificate
481 * has been received in order to verify it on receipt rather than
482 * doing after the handshake is completed.
484 * The callback's function prototype is:
485 * int (*callback)(gnutls_session_t);
487 * If the callback function is provided then gnutls will call it, in the
488 * handshake, just after the certificate message has been received.
489 * To verify or obtain the certificate the gnutls_certificate_verify_peers2(),
490 * gnutls_certificate_type_get(), gnutls_certificate_get_peers() functions
493 * The callback function should return 0 for the handshake to continue
494 * or non-zero to terminate.
499 gnutls_certificate_set_verify_function
500 (gnutls_certificate_credentials_t cred
,
501 gnutls_certificate_verify_function
* func
)
503 cred
->verify_callback
= func
;
507 * _gnutls_x509_extract_certificate_activation_time - return the peer's certificate activation time
508 * @cert: should contain an X.509 DER encoded certificate
510 * This function will return the certificate's activation time in UNIX time
511 * (ie seconds since 00:00:00 UTC January 1, 1970).
513 * Returns a (time_t) -1 in case of an error.
517 _gnutls_x509_get_raw_crt_activation_time (const gnutls_datum_t
* cert
)
519 gnutls_x509_crt_t xcert
;
522 result
= gnutls_x509_crt_init (&xcert
);
526 result
= gnutls_x509_crt_import (xcert
, cert
, GNUTLS_X509_FMT_DER
);
529 gnutls_x509_crt_deinit (xcert
);
533 result
= gnutls_x509_crt_get_activation_time (xcert
);
535 gnutls_x509_crt_deinit (xcert
);
541 * gnutls_x509_extract_certificate_expiration_time:
542 * @cert: should contain an X.509 DER encoded certificate
544 * This function will return the certificate's expiration time in UNIX
545 * time (ie seconds since 00:00:00 UTC January 1, 1970). Returns a
547 * (time_t) -1 in case of an error.
551 _gnutls_x509_get_raw_crt_expiration_time (const gnutls_datum_t
* cert
)
553 gnutls_x509_crt_t xcert
;
556 result
= gnutls_x509_crt_init (&xcert
);
560 result
= gnutls_x509_crt_import (xcert
, cert
, GNUTLS_X509_FMT_DER
);
563 gnutls_x509_crt_deinit (xcert
);
567 result
= gnutls_x509_crt_get_expiration_time (xcert
);
569 gnutls_x509_crt_deinit (xcert
);
574 #ifdef ENABLE_OPENPGP
576 * _gnutls_openpgp_crt_verify_peers - return the peer's certificate status
577 * @session: is a gnutls session
579 * This function will try to verify the peer's certificate and return its status (TRUSTED, INVALID etc.).
580 * Returns a negative error code in case of an error, or GNUTLS_E_NO_CERTIFICATE_FOUND if no certificate was sent.
583 _gnutls_openpgp_crt_verify_peers (gnutls_session_t session
,
584 unsigned int *status
)
586 cert_auth_info_t info
;
587 gnutls_certificate_credentials_t cred
;
588 int peer_certificate_list_size
, ret
;
590 CHECK_AUTH (GNUTLS_CRD_CERTIFICATE
, GNUTLS_E_INVALID_REQUEST
);
592 info
= _gnutls_get_auth_info (session
);
594 return GNUTLS_E_INVALID_REQUEST
;
596 cred
= (gnutls_certificate_credentials_t
)
597 _gnutls_get_cred (session
->key
, GNUTLS_CRD_CERTIFICATE
, NULL
);
601 return GNUTLS_E_INSUFFICIENT_CREDENTIALS
;
604 if (info
->raw_certificate_list
== NULL
|| info
->ncerts
== 0)
607 return GNUTLS_E_NO_CERTIFICATE_FOUND
;
610 /* generate a list of gnutls_certs based on the auth info
613 peer_certificate_list_size
= info
->ncerts
;
615 if (peer_certificate_list_size
!= 1)
618 return GNUTLS_E_INTERNAL_ERROR
;
621 /* Verify certificate
624 _gnutls_openpgp_verify_key (cred
, &info
->raw_certificate_list
[0],
625 peer_certificate_list_size
, status
);
638 * gnutls_certificate_verify_peers2:
639 * @session: is a gnutls session
640 * @status: is the output of the verification
642 * This function will try to verify the peer's certificate and return
643 * its status (trusted, invalid etc.). The value of @status should
644 * be one or more of the gnutls_certificate_status_t enumerated
645 * elements bitwise or'd. To avoid denial of service attacks some
646 * default upper limits regarding the certificate key size and chain
647 * size are set. To override them use gnutls_certificate_set_verify_limits().
649 * This function will utilize the OCSP Certificate Status extension if
650 * negotiated --to enable see gnutls_ocsp_status_request_enable_client().
652 * Note that you must also check the peer's name in order to check if
653 * the verified certificate belongs to the actual peer, see gnutls_x509_crt_check_hostname().
655 * Returns: a negative error code on error and %GNUTLS_E_SUCCESS (0) on success.
658 gnutls_certificate_verify_peers2 (gnutls_session_t session
,
659 unsigned int *status
)
661 cert_auth_info_t info
;
663 CHECK_AUTH (GNUTLS_CRD_CERTIFICATE
, GNUTLS_E_INVALID_REQUEST
);
665 info
= _gnutls_get_auth_info (session
);
668 return GNUTLS_E_NO_CERTIFICATE_FOUND
;
671 if (info
->raw_certificate_list
== NULL
|| info
->ncerts
== 0)
672 return GNUTLS_E_NO_CERTIFICATE_FOUND
;
674 switch (gnutls_certificate_type_get (session
))
676 case GNUTLS_CRT_X509
:
677 return _gnutls_x509_cert_verify_peers (session
, status
);
678 #ifdef ENABLE_OPENPGP
679 case GNUTLS_CRT_OPENPGP
:
680 return _gnutls_openpgp_crt_verify_peers (session
, status
);
683 return GNUTLS_E_INVALID_REQUEST
;
688 * gnutls_certificate_expiration_time_peers:
689 * @session: is a gnutls session
691 * This function will return the peer's certificate expiration time.
693 * Returns: (time_t)-1 on error.
695 * Deprecated: gnutls_certificate_verify_peers2() now verifies expiration times.
698 gnutls_certificate_expiration_time_peers (gnutls_session_t session
)
700 cert_auth_info_t info
;
702 CHECK_AUTH (GNUTLS_CRD_CERTIFICATE
, GNUTLS_E_INVALID_REQUEST
);
704 info
= _gnutls_get_auth_info (session
);
710 if (info
->raw_certificate_list
== NULL
|| info
->ncerts
== 0)
716 switch (gnutls_certificate_type_get (session
))
718 case GNUTLS_CRT_X509
:
720 _gnutls_x509_get_raw_crt_expiration_time (&info
->raw_certificate_list
722 #ifdef ENABLE_OPENPGP
723 case GNUTLS_CRT_OPENPGP
:
725 _gnutls_openpgp_get_raw_key_expiration_time
726 (&info
->raw_certificate_list
[0]);
734 * gnutls_certificate_activation_time_peers:
735 * @session: is a gnutls session
737 * This function will return the peer's certificate activation time.
738 * This is the creation time for openpgp keys.
740 * Returns: (time_t)-1 on error.
742 * Deprecated: gnutls_certificate_verify_peers2() now verifies activation times.
745 gnutls_certificate_activation_time_peers (gnutls_session_t session
)
747 cert_auth_info_t info
;
749 CHECK_AUTH (GNUTLS_CRD_CERTIFICATE
, GNUTLS_E_INVALID_REQUEST
);
751 info
= _gnutls_get_auth_info (session
);
757 if (info
->raw_certificate_list
== NULL
|| info
->ncerts
== 0)
763 switch (gnutls_certificate_type_get (session
))
765 case GNUTLS_CRT_X509
:
767 _gnutls_x509_get_raw_crt_activation_time (&info
->raw_certificate_list
769 #ifdef ENABLE_OPENPGP
770 case GNUTLS_CRT_OPENPGP
:
772 _gnutls_openpgp_get_raw_key_creation_time (&info
->raw_certificate_list
781 * gnutls_sign_callback_set:
782 * @session: is a gnutls session
783 * @sign_func: function pointer to application's sign callback.
784 * @userdata: void pointer that will be passed to sign callback.
786 * Set the callback function. The function must have this prototype:
788 * typedef int (*gnutls_sign_func) (gnutls_session_t session,
790 * gnutls_certificate_type_t cert_type,
791 * const gnutls_datum_t * cert,
792 * const gnutls_datum_t * hash,
793 * gnutls_datum_t * signature);
795 * The @userdata parameter is passed to the @sign_func verbatim, and
796 * can be used to store application-specific data needed in the
797 * callback function. See also gnutls_sign_callback_get().
799 * Deprecated: Use the PKCS 11 or #gnutls_privkey_t interfacess like gnutls_privkey_import_ext() instead.
802 gnutls_sign_callback_set (gnutls_session_t session
,
803 gnutls_sign_func sign_func
, void *userdata
)
805 session
->internals
.sign_func
= sign_func
;
806 session
->internals
.sign_func_userdata
= userdata
;
810 * gnutls_sign_callback_get:
811 * @session: is a gnutls session
812 * @userdata: if non-%NULL, will be set to abstract callback pointer.
814 * Retrieve the callback function, and its userdata pointer.
816 * Returns: The function pointer set by gnutls_sign_callback_set(), or
819 * Deprecated: Use the PKCS 11 interfaces instead.
822 gnutls_sign_callback_get (gnutls_session_t session
, void **userdata
)
825 *userdata
= session
->internals
.sign_func_userdata
;
826 return session
->internals
.sign_func
;
829 /* returns error if the certificate has different algorithm than
830 * the given key parameters.
833 _gnutls_check_key_cert_match (gnutls_certificate_credentials_t res
)
835 int pk
= gnutls_pubkey_get_pk_algorithm(res
->certs
[res
->ncerts
-1].cert_list
[0].pubkey
, NULL
);
836 int pk2
= gnutls_privkey_get_pk_algorithm (res
->pkey
[res
->ncerts
- 1], NULL
);
841 return GNUTLS_E_CERTIFICATE_KEY_MISMATCH
;