WEBVIEW_SECURITY_INFO  
 

The WEBVIEW_SECURITY_INFO structure contains information about the current state of a secure connection.

typedef struct _WEBVIEW_SECURITY_INFO
{
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dwLevel;
    TCHAR szProtocol[32];
    TCHAR szCipher[64];
    TCHAR szSubject[128];
    TCHAR szIssuer[128];
    FILETIME ftValidFrom;
    FILETIME ftValidTo;
} WEBVIEW_SECURITY_INFO, *LPWEBVIEW_SECURITY_INFO;

Members

dwSize
Specifies the size of the structure in bytes. This member must be initialized by the caller.
dwFlags
A bitmask that provides additional detail about the connection and certificate state. One or more values may be set to indicate conditions such as unencrypted content, use of weak algorithms, or general certificate errors. It may be one or more of the security flags listed below.
Name Description
WEBVIEW_SECURITY_FLAG_NONE No additional security indicators.
WEBVIEW_SECURITY_FLAG_UNENCRYPTED Content is not encrypted.
WEBVIEW_SECURITY_FLAG_INSECURE Site is insecure using outdated protocols or weak ciphers.
WEBVIEW_SECURITY_FLAG_CERT_WEAK The certificate uses weak signatures.
WEBVIEW_SECURITY_FLAG_CERT_ERROR The certificate is invalid. This is a general error condition.
WEBVIEW_SECURITY_FLAG_CERT_EXPIRED The certificate expired but is otherwise valid.
WEBVIEW_SECURITY_FLAG_UNSAFE The site is considered potentially unsafe (it failed reputation checks).
dwLevel
Overall security level for the current page. This is a summarized assessment intended for UI decisions, such as showing a lock icon or warning. It maps to one of the security level values listed below.
Name Description
WEBVIEW_SECURITY_LEVEL_UNKNOWN The security state could not be determined.
WEBVIEW_SECURITY_LEVEL_INSECURE The page was retrieved using plain HTTP or the site has an invalid certificate.
WEBVIEW_SECURITY_LEVEL_WARNING The page contains mixed content or only weak encryption is available.
WEBVIEW_SECURITY_LEVEL_NEUTRAL Local content or the browser is in a transitional/loading state.
WEBVIEW_SECURITY_LEVEL_SECURE The page was retrieved using HTTPS and the site has a valid certificate.
szProtocol
A null-terminated string that names the negotiated security protocol, such as "TLS 1.3" or "TLS 1.2". For plain HTTP and local content, this string is empty.
szCipher
A null-terminated string that identifies the selected cipher suite, such as "TLS_AES_128_GCM_SHA256". This string is empty if the site is not secure or local content is being displayed.
szSubject
A null-terminated string which contains the certificate subject. Typically this includes the common name (CN) and/or subject alternative name which matches the hostname.
szIssuer
A null-terminated string which specifies the certificate issuer. This is normally the name of the Certificate Authority (CA) which provided the certificate.
ftValidFrom
The date and time when the certificate was issued. This is represented as a standard FILETIME structure.
ftValidTo
The date and time when the certificate expires. This is represented as a standard FILETIME structure.

Remarks

The security information reflects the state of the last navigation. During navigation, values can be provisional; the final, authoritative values are available after the navigation completes. The dwLevel value is an assessment that may be adjusted by the engine for conditions such as mixed content, weak ciphers, or certificate problems. The dwFlags field provides the underlying reasons and may have multiple bitflags set. Applications should check for combinations (for example, a page might be secure overall but also report a warning flag if subresources were blocked).

For plain HTTP (unencrypted) pages, dwLevel is typically WEBVIEW_SECURITY_LEVEL_INSECURE. The szProtocol and szCipher members are empty strings and dwFlags will include WEBVIEW_SECURITY_FLAG_UNENCRYPTED. For HTTPS with a valid certificate, dwLevel is typically WEBVIEW_SECURITY_LEVEL_SECURE, and other members identify the negotiated TLS version and cipher suite. If the certificate is expired or otherwise invalid, the security level is downgraded and the corresponding certificate flags are set.

The szSubject and szIssuer strings are for display and logging purposes; certificate parsing and validation is handled by the browser. The validity timestamps (ftValidFrom and ftValidTo) are provided to enable simple checks, but applications do not need to implement certificate validation logic themselves.

Set the dwSize member to the actual size of the structure before calling GetSecurityInfo. If the caller passes a different size than expected, the method will fail or only populate the fields known to that size.

Both ANSI (A) and Unicode (W) variants are provided. When compiling with UNICODE defined, the TCHAR strings are UTF-16. In ANSI builds, they are UTF-8. The GetSecurityInfo macro resolves to the appropriate version based on the project's character set.

Because the browser can update security state as additional resources are loaded, applications that display a security indicator should refresh it on navigation completion events. Treat the security level as ordered and do not "upgrade" a previously observed state during the same navigation unless a later callback provides a higher confidence result. Note that it's also possible for the security level to be WEBVIEW_SECURITY_LEVEL_SECURE during navigation, but may be downgraded to WEBVIEW_SECURITY_LEVEL_WARNING when navigation completes due to mixed content in the page.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h.
Unicode: Implemented as Unicode and ANSI versions

See Also