OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // of seconds. | 287 // of seconds. |
288 void ResetIdentitiesWithValidity(int not_before, int not_after) { | 288 void ResetIdentitiesWithValidity(int not_before, int not_after) { |
289 CreateStreams(); | 289 CreateStreams(); |
290 | 290 |
291 client_ssl_.reset(rtc::SSLStreamAdapter::Create(client_stream_)); | 291 client_ssl_.reset(rtc::SSLStreamAdapter::Create(client_stream_)); |
292 server_ssl_.reset(rtc::SSLStreamAdapter::Create(server_stream_)); | 292 server_ssl_.reset(rtc::SSLStreamAdapter::Create(server_stream_)); |
293 | 293 |
294 client_ssl_->SignalEvent.connect(this, &SSLStreamAdapterTestBase::OnEvent); | 294 client_ssl_->SignalEvent.connect(this, &SSLStreamAdapterTestBase::OnEvent); |
295 server_ssl_->SignalEvent.connect(this, &SSLStreamAdapterTestBase::OnEvent); | 295 server_ssl_->SignalEvent.connect(this, &SSLStreamAdapterTestBase::OnEvent); |
296 | 296 |
| 297 time_t now = time(nullptr); |
| 298 |
297 rtc::SSLIdentityParams client_params; | 299 rtc::SSLIdentityParams client_params; |
298 client_params.key_params = rtc::KeyParams(rtc::KT_DEFAULT); | 300 client_params.key_params = rtc::KeyParams(rtc::KT_DEFAULT); |
299 client_params.common_name = "client"; | 301 client_params.common_name = "client"; |
300 client_params.not_before = not_before; | 302 client_params.not_before = now + not_before; |
301 client_params.not_after = not_after; | 303 client_params.not_after = now + not_after; |
302 client_identity_ = rtc::SSLIdentity::GenerateForTest(client_params); | 304 client_identity_ = rtc::SSLIdentity::GenerateForTest(client_params); |
303 | 305 |
304 rtc::SSLIdentityParams server_params; | 306 rtc::SSLIdentityParams server_params; |
305 server_params.key_params = rtc::KeyParams(rtc::KT_DEFAULT); | 307 server_params.key_params = rtc::KeyParams(rtc::KT_DEFAULT); |
306 server_params.common_name = "server"; | 308 server_params.common_name = "server"; |
307 server_params.not_before = not_before; | 309 server_params.not_before = now + not_before; |
308 server_params.not_after = not_after; | 310 server_params.not_after = now + not_after; |
309 server_identity_ = rtc::SSLIdentity::GenerateForTest(server_params); | 311 server_identity_ = rtc::SSLIdentity::GenerateForTest(server_params); |
310 | 312 |
311 client_ssl_->SetIdentity(client_identity_); | 313 client_ssl_->SetIdentity(client_identity_); |
312 server_ssl_->SetIdentity(server_identity_); | 314 server_ssl_->SetIdentity(server_identity_); |
313 } | 315 } |
314 | 316 |
315 virtual void OnEvent(rtc::StreamInterface *stream, int sig, int err) { | 317 virtual void OnEvent(rtc::StreamInterface *stream, int sig, int err) { |
316 LOG(LS_INFO) << "SSLStreamAdapterTestBase::OnEvent sig=" << sig; | 318 LOG(LS_INFO) << "SSLStreamAdapterTestBase::OnEvent sig=" << sig; |
317 | 319 |
318 if (sig & rtc::SE_READ) { | 320 if (sig & rtc::SE_READ) { |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); | 1153 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); |
1152 INSTANTIATE_TEST_CASE_P( | 1154 INSTANTIATE_TEST_CASE_P( |
1153 SSLStreamAdapterTestsDTLS, | 1155 SSLStreamAdapterTestsDTLS, |
1154 SSLStreamAdapterTestDTLS, | 1156 SSLStreamAdapterTestDTLS, |
1155 Combine(Values(rtc::KeyParams::RSA(1024, 65537), | 1157 Combine(Values(rtc::KeyParams::RSA(1024, 65537), |
1156 rtc::KeyParams::RSA(1152, 65537), | 1158 rtc::KeyParams::RSA(1152, 65537), |
1157 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)), | 1159 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)), |
1158 Values(rtc::KeyParams::RSA(1024, 65537), | 1160 Values(rtc::KeyParams::RSA(1024, 65537), |
1159 rtc::KeyParams::RSA(1152, 65537), | 1161 rtc::KeyParams::RSA(1152, 65537), |
1160 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); | 1162 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); |
OLD | NEW |