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

Unified Diff: webrtc/base/sslidentity_unittest.cc

Issue 1683193003: Implement certificate lifetime parameter as required by WebRTC RFC. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address feedback Created 4 years, 10 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
« webrtc/base/sslidentity.cc ('K') | « webrtc/base/sslidentity.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/sslidentity_unittest.cc
diff --git a/webrtc/base/sslidentity_unittest.cc b/webrtc/base/sslidentity_unittest.cc
index 3582edb4a4bfa5c48e3a91535ab9946d30eb0fbf..8e25fe97dfc1ca460d49adb9c009942d278e7674 100644
--- a/webrtc/base/sslidentity_unittest.cc
+++ b/webrtc/base/sslidentity_unittest.cc
@@ -387,18 +387,17 @@ class SSLIdentityExpirationTest : public testing::Test {
}
void TestExpireTime(int times) {
+ // We test just ECDSA here since what we're out to exercise is the
+ // interfaces for expiration setting and reading.
for (int i = 0; i < times; i++) {
- rtc::SSLIdentityParams params;
- params.common_name = "";
- params.not_before = 0;
// We limit the time to < 2^31 here, i.e., we stay before 2038, since else
// we hit time offset limitations in OpenSSL on some 32-bit systems.
- params.not_after = rtc::CreateRandomId() % 0x80000000;
- // We test just ECDSA here since what we're out to exercise here is the
- // code for expiration setting and reading.
- params.key_params = rtc::KeyParams::ECDSA(rtc::EC_NIST_P256);
- SSLIdentity* identity = rtc::SSLIdentity::GenerateForTest(params);
- EXPECT_EQ(params.not_after,
+ time_t now = time(NULL);
+ time_t lifetime = rtc::CreateRandomId() % (0x80000000 - now);
+ rtc::KeyParams key_params = rtc::KeyParams::ECDSA(rtc::EC_NIST_P256);
+ SSLIdentity* identity =
+ rtc::SSLIdentity::Generate("", key_params, lifetime);
+ EXPECT_EQ(now + lifetime,
identity->certificate().CertificateExpirationTime());
delete identity;
}
« webrtc/base/sslidentity.cc ('K') | « webrtc/base/sslidentity.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698