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

Unified Diff: webrtc/base/rtccertificate.cc

Issue 1494103003: RTCCertificate::Expires() and ::HasExpired() implemented (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed nits Created 5 years 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
« no previous file with comments | « webrtc/base/rtccertificate.h ('k') | webrtc/base/rtccertificate_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/rtccertificate.cc
diff --git a/webrtc/base/rtccertificate.cc b/webrtc/base/rtccertificate.cc
index a176d9080b2cc02dacced71778f453d88b81a414..7b764bd72e66faa2a63afb49894f61414ca15d08 100644
--- a/webrtc/base/rtccertificate.cc
+++ b/webrtc/base/rtccertificate.cc
@@ -11,7 +11,6 @@
#include "webrtc/base/rtccertificate.h"
#include "webrtc/base/checks.h"
-#include "webrtc/base/timeutils.h"
namespace rtc {
@@ -28,13 +27,16 @@ RTCCertificate::RTCCertificate(SSLIdentity* identity)
RTCCertificate::~RTCCertificate() {
}
-uint64_t RTCCertificate::expires_timestamp_ns() const {
- // TODO(hbos): Update once SSLIdentity/SSLCertificate supports expires field.
- return 0;
+uint64_t RTCCertificate::Expires() const {
+ int64_t expires = ssl_certificate().CertificateExpirationTime();
+ if (expires != -1)
+ return static_cast<uint64_t>(expires) * kNumMillisecsPerSec;
+ // If the expiration time could not be retrieved return an expired timestamp.
+ return 0; // = 1970-01-01
}
-bool RTCCertificate::HasExpired() const {
- return expires_timestamp_ns() <= TimeNanos();
+bool RTCCertificate::HasExpired(uint64_t now) const {
+ return Expires() <= now;
}
const SSLCertificate& RTCCertificate::ssl_certificate() const {
« no previous file with comments | « webrtc/base/rtccertificate.h ('k') | webrtc/base/rtccertificate_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698