@@ -234,9 +234,12 @@ struct BotanTLSProvider : public TLSProvider,
234
234
235
235
virtual void startEncryption () override
236
236
{
237
+ auto certStorePtr = contextPtr_->certStore .get ();
238
+ if (certStorePtr == nullptr )
239
+ certStorePtr = &certStore;
237
240
credsPtr_ = std::make_shared<Credentials>(contextPtr_->key ,
238
241
contextPtr_->cert .get (),
239
- contextPtr_-> certStore . get () );
242
+ certStorePtr );
240
243
if (policyPtr_->getConfCmds ().empty () == false )
241
244
LOG_WARN << " BotanTLSConnectionImpl does not support sslConfCmds." ;
242
245
@@ -329,28 +332,24 @@ struct BotanTLSProvider : public TLSProvider,
329
332
}
330
333
}
331
334
332
- void tls_session_established (
333
- const Botan::TLS::Session_Summary &session) override
335
+ void tls_session_activated () override
334
336
{
335
- (void )session;
336
- LOG_TRACE << " tls_session_established" ;
337
+ LOG_TRACE << " tls_session_activated" ;
337
338
tlsConnected_ = true ;
338
- loop_->queueInLoop ([this ]() {
339
- setApplicationProtocol (channel_->application_protocol ());
340
- if (handshakeCallback_)
341
- handshakeCallback_ (conn_);
342
- });
339
+ setApplicationProtocol (channel_->application_protocol ());
340
+ if (handshakeCallback_)
341
+ handshakeCallback_ (conn_);
343
342
}
344
343
345
344
void tls_verify_cert_chain (
346
345
const std::vector<Botan::X509_Certificate> &certs,
347
346
const std::vector<std::optional<Botan::OCSP::Response>> &ocsp,
348
347
const std::vector<Botan::Certificate_Store *> &trusted_roots,
349
348
Botan::Usage_Type usage,
350
- const std::string & hostname,
351
- const Botan::TLS::Policy &policy)
349
+ std::string_view hostname,
350
+ const Botan::TLS::Policy &policy) override
352
351
{
353
- setSniName (hostname);
352
+ setSniName (std::string ( hostname) );
354
353
if (policyPtr_->getValidate () && !policyPtr_->getAllowBrokenChain ())
355
354
Botan::TLS::Callbacks::tls_verify_cert_chain (
356
355
certs, ocsp, trusted_roots, usage, hostname, policy);
@@ -379,6 +378,9 @@ struct BotanTLSProvider : public TLSProvider,
379
378
std::string (" Certificate validation failed: " ) +
380
379
Botan::to_string (result));
381
380
}
381
+
382
+ if (certs.size () > 0 )
383
+ setPeerCertificate (std::make_shared<BotanCertificate>(certs[0 ]));
382
384
}
383
385
384
386
std::shared_ptr<TrantorPolicy> validationPolicy_;
0 commit comments