250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
+
+
-
+
|
errorCode: initFailedErrorCode];
if (_verifiesCertificates)
gnutls_session_set_verify_cert(_session, _host.UTF8String, 0);
}
if (_certificateChain != nil) {
OFGnuTLSX509CertificatePrivateKey *privateKey =
(OFGnuTLSX509CertificatePrivateKey *)_privateKey;
OFMutableData *certs = [OFMutableData
dataWithItemSize: sizeof(gnutls_x509_crt_t)
capacity: _certificateChain.count];
for (OFGnuTLSX509Certificate *cert in _certificateChain) {
gnutls_x509_crt_t gnuTLSCert =
cert.of_gnuTLSCertificate;
[certs addItem: &gnuTLSCert];
}
if (gnutls_certificate_set_x509_key(_credentials,
(gnutls_x509_crt_t *)certs.items, (unsigned int)certs.count,
[_privateKey of_gnuTLSPrivateKey]) < 0)
privateKey.of_gnuTLSPrivateKey) < 0)
@throw [OFTLSHandshakeFailedException
exceptionWithStream: self
host: host
errorCode: initFailedErrorCode];
}
if (gnutls_credentials_set(_session, GNUTLS_CRD_CERTIFICATE,
|