diff --git a/rtc_base/boringssl_certificate.cc b/rtc_base/boringssl_certificate.cc
index a4f919fbbe..fe3beeaed9 100644
--- a/rtc_base/boringssl_certificate.cc
+++ b/rtc_base/boringssl_certificate.cc
@@ -252,6 +252,12 @@ BoringSSLCertificate::BoringSSLCertificate(
   RTC_DCHECK(cert_buffer_ != nullptr);
 }
 
+BoringSSLCertificate::BoringSSLCertificate(
+    bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer, SSL* ssl)
+    : cert_buffer_(std::move(cert_buffer)), ssl_(ssl) {
+  RTC_DCHECK(cert_buffer_ != nullptr);
+}
+
 std::unique_ptr<BoringSSLCertificate> BoringSSLCertificate::Generate(
     OpenSSLKeyPair* key_pair,
     const SSLIdentityParams& params) {
diff --git a/rtc_base/boringssl_certificate.h b/rtc_base/boringssl_certificate.h
index b5a18d0843..53759fd064 100644
--- a/rtc_base/boringssl_certificate.h
+++ b/rtc_base/boringssl_certificate.h
@@ -34,6 +34,7 @@ namespace webrtc {
 class BoringSSLCertificate final : public SSLCertificate {
  public:
   explicit BoringSSLCertificate(bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer);
+  BoringSSLCertificate(bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer, SSL* ssl);
 
   static std::unique_ptr<BoringSSLCertificate> Generate(
       OpenSSLKeyPair* key_pair,
@@ -66,6 +67,10 @@ class BoringSSLCertificate final : public SSLCertificate {
  private:
   // A handle to the DER encoded certificate data.
   bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer_;
+  SSL* ssl_ = nullptr;
+
+ public:
+  SSL* ssl() const { return ssl_; }
 };
 
 }  //  namespace webrtc
diff --git a/rtc_base/openssl_adapter.cc b/rtc_base/openssl_adapter.cc
index b80e665d78..1f3dd28795 100644
--- a/rtc_base/openssl_adapter.cc
+++ b/rtc_base/openssl_adapter.cc
@@ -846,7 +846,7 @@ enum ssl_verify_result_t OpenSSLAdapter::SSLVerifyInternal(SSL* ssl,
   std::vector<std::unique_ptr<SSLCertificate>> certs;
   for (size_t i = 0; i < sk_CRYPTO_BUFFER_num(chain); ++i) {
     certs.emplace_back(new BoringSSLCertificate(
-        bssl::UpRef(sk_CRYPTO_BUFFER_value(chain, i))));
+        bssl::UpRef(sk_CRYPTO_BUFFER_value(chain, i)), ssl));
   }
 
   SSLCertChain cert_chain(std::move(certs));
@@ -932,7 +932,7 @@ int OpenSSLAdapter::SSLVerifyInternal(int previous_status,
       RTC_LOG(LS_ERROR) << "Failed to allocate CRYPTO_BUFFER.";
       return previous_status;
     }
-    certs.emplace_back(new BoringSSLCertificate(std::move(crypto_buffer)));
+    certs.emplace_back(new BoringSSLCertificate(std::move(crypto_buffer), ssl));
 #else
     certs.emplace_back(new OpenSSLCertificate(x509_cert));
 #endif
