Skip to content

CefSSLInfo

Header: cef_ssl_info.h
Interfaces: CefSSLInfo, CefSSLStatus
Category: Core APIs

Overview

Foundational interfaces: process bootstrap, browser lifecycle, frames, DOM, requests, and data objects.

CefSSLInfo

Source File: include/cef_ssl_info.h

Process / Thread Context: Threading not specified in header; signature-based inference only (typically obtained from request callbacks executed on the browser process UI/IO thread).

Purpose: USER-CALLED library interface representing SSL information for a request/navigation. Provides the cert verification status bitmask and the X.509 certificate object.

Methods

cef_cert_status_t GetCertStatus()

Parameters:

  • None.

Return Value: Bitmask of CERT_STATUS_* flags indicating verification problems. Defaults to CERT_STATUS_NONE.

Usage Instruction: Use CefIsCertStatusError() to test if status represents an error.

Threading Constraint: Threading constraint not specified in header.

CefRefPtr<CefX509Certificate> GetX509Certificate()

Parameters:

  • None.

Return Value: The X.509 server certificate object (may be NULL).

Usage Instruction: Inspect subject/issuer/DER/PEM/chain details via CefX509Certificate methods.

Threading Constraint: Threading constraint not specified in header.

bool CefIsCertStatusError(cef_cert_status_t status)

Return Value: Returns true if the certificate status represents an error.

Threading Constraint: Threading constraint not specified in source.

Usage Example

cpp
// Inside CefRequestHandler::OnCertificateError or another callback that supplies
// a CefRefPtr<CefSSLInfo> info:
if (CefIsCertStatusError(info->GetCertStatus())) {
  CefRefPtr<CefX509Certificate> cert = info->GetX509Certificate();
  if (cert) {
    CefRefPtr<CefX509CertPrincipal> subject = cert->GetSubject();
    CefString cn = subject->GetCommonName();
    // ... display or compare ...
  }
}

CefSSLStatus

Source File: include/cef_ssl_status.h

Process / Thread Context: Threading not specified in header. Typically obtained from CefNavigationEntry::GetSSLStatus() on the browser process UI thread.

Purpose: USER-CALLED library interface representing the SSL status of a navigation entry (a snapshot of SSL state for a page). Adds connection security, SSL version, and content status flags on top of CefSSLInfo-style data.

Methods

bool IsSecureConnection()

Return Value: True if the connection used SSL/TLS (secure).

Usage Instruction: Display lock icon / security indicator.

Threading Constraint: Threading constraint not specified in header.

cef_cert_status_t GetCertStatus()

Return Value: Bitmask of cert verification issues; defaults to CERT_STATUS_NONE.

Usage Instruction: Use CefIsCertStatusError() to check for errors.

Threading Constraint: Threading constraint not specified in header.

cef_ssl_version_t GetSSLVersion()

Return Value: SSL/TLS version used; defaults to SSL_CONNECTION_VERSION_UNKNOWN.

Usage Instruction: Display TLS version in security details.

Threading Constraint: Threading constraint not specified in header.

cef_ssl_content_status_t GetContentStatus()

Return Value: Bitmask of SSL_CONTENT_* flags (mixed content, secure content, etc.); defaults to SSL_CONTENT_NORMAL_CONTENT.

Usage Instruction: Detect mixed-content pages.

Threading Constraint: Threading constraint not specified in header.

CefRefPtr<CefX509Certificate> GetX509Certificate()

Return Value: The X.509 certificate (may be NULL).

Usage Instruction: Drill into subject/issuer/chain details.

Threading Constraint: Threading constraint not specified in header.

Usage Example

cpp
// From CefBrowserHost::GetVisibleNavigationEntry on the UI thread:
CefRefPtr<CefNavigationEntry> entry = browser->GetHost()->GetVisibleNavigationEntry();
if (entry) {
  CefRefPtr<CefSSLStatus> ssl = entry->GetSSLStatus();
  if (ssl && ssl->IsSecureConnection()) {
    cef_ssl_version_t ver = ssl->GetSSLVersion();
    cef_ssl_content_status_t content = ssl->GetContentStatus();
    CefRefPtr<CefX509Certificate> cert = ssl->GetX509Certificate();
    // ... populate security UI ...
  }
}

Derived from the CEF C++ headers — © Marshall A. Greenblatt, Google Inc. & contributors (BSD-style license). Not an official CEF project.