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.