Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Unified Diff: webrtc/base/sslidentity.h

Issue 2259283002: Refactor certificate stats collection, added SSLCertificateStats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Another unittest for the case of certificate chains using fake certificates Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/base/sslidentity.h
diff --git a/webrtc/base/sslidentity.h b/webrtc/base/sslidentity.h
index 857a27cfc7ba069e4729f705b0ce4234f1c38ecd..181174b265f1ce3bd347c3a8590629be30719734 100644
--- a/webrtc/base/sslidentity.h
+++ b/webrtc/base/sslidentity.h
@@ -28,6 +28,18 @@ namespace rtc {
// Forward declaration due to circular dependency with SSLCertificate.
class SSLCertChain;
+struct SSLCertificateStats {
+ SSLCertificateStats(std::string&& fingerprint,
+ std::string&& fingerprint_algorithm,
+ std::string&& base64_certificate,
+ std::unique_ptr<SSLCertificateStats>&& issuer);
+ ~SSLCertificateStats();
+ std::string fingerprint;
+ std::string fingerprint_algorithm;
+ std::string base64_certificate;
+ std::unique_ptr<SSLCertificateStats> issuer;
+};
+
// Abstract interface overridden by SSL library specific
// implementations.
@@ -75,6 +87,15 @@ class SSLCertificate {
// Returns the time in seconds relative to epoch, 1970-01-01T00:00:00Z (UTC),
// or -1 if an expiration time could not be retrieved.
virtual int64_t CertificateExpirationTime() const = 0;
+
+ // Gets information (fingerprint, etc.) about this certificate and its chain
+ // (if it has a certificate chain). This is used for certificate stats, see
+ // https://w3c.github.io/webrtc-stats/#certificatestats-dict*.
+ std::unique_ptr<SSLCertificateStats> GetStats() const;
+
+ private:
+ std::unique_ptr<SSLCertificateStats> GetStats(
+ std::unique_ptr<SSLCertificateStats> issuer) const;
};
// SSLCertChain is a simple wrapper for a vector of SSLCertificates. It serves

Powered by Google App Engine
This is Rietveld 408576698