OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 void set_should_fail(bool should_fail) { | 91 void set_should_fail(bool should_fail) { |
92 should_fail_ = should_fail; | 92 should_fail_ = should_fail; |
93 } | 93 } |
94 | 94 |
95 void use_original_key() { key_index_ = 0; } | 95 void use_original_key() { key_index_ = 0; } |
96 void use_alternate_key() { key_index_ = 1; } | 96 void use_alternate_key() { key_index_ = 1; } |
97 | 97 |
98 void RequestIdentity( | 98 void RequestIdentity( |
99 rtc::KeyParams key_params, | 99 rtc::KeyParams key_params, |
100 rtc::Optional<uint64_t> expires, | 100 const rtc::Optional<uint64_t>& expires_ms, |
101 const rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>& | 101 const rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>& |
102 observer) override { | 102 observer) override { |
103 // TODO(hbos): Should be able to generate KT_ECDSA too. | 103 // TODO(hbos): Should be able to generate KT_ECDSA too. |
104 RTC_DCHECK((key_params.type() == rtc::KT_RSA && | 104 RTC_DCHECK((key_params.type() == rtc::KT_RSA && |
105 key_params.rsa_params().mod_size == 1024 && | 105 key_params.rsa_params().mod_size == 1024 && |
106 key_params.rsa_params().pub_exp == 0x10001) || | 106 key_params.rsa_params().pub_exp == 0x10001 && |
| 107 !expires_ms) || |
107 should_fail_); | 108 should_fail_); |
108 MessageData* msg = new MessageData( | 109 MessageData* msg = new MessageData( |
109 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>(observer)); | 110 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>(observer)); |
110 rtc::Thread::Current()->Post( | 111 rtc::Thread::Current()->Post( |
111 this, should_fail_ ? MSG_FAILURE : MSG_SUCCESS, msg); | 112 this, should_fail_ ? MSG_FAILURE : MSG_SUCCESS, msg); |
112 } | 113 } |
113 | 114 |
114 static rtc::scoped_refptr<rtc::RTCCertificate> GenerateCertificate() { | 115 static rtc::scoped_refptr<rtc::RTCCertificate> GenerateCertificate() { |
115 std::string cert; | 116 std::string cert; |
116 std::string key; | 117 std::string key; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 break; | 163 break; |
163 } | 164 } |
164 delete message_data; | 165 delete message_data; |
165 } | 166 } |
166 | 167 |
167 bool should_fail_; | 168 bool should_fail_; |
168 int key_index_ = 0; | 169 int key_index_ = 0; |
169 }; | 170 }; |
170 | 171 |
171 #endif // WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 172 #endif // WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
OLD | NEW |