| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // The certificates are created from constant PEM strings and use its coded | 144 // The certificates are created from constant PEM strings and use its coded |
| 145 // expiration time, we do not support modifying it. | 145 // expiration time, we do not support modifying it. |
| 146 RTC_DCHECK(!expires_ms); | 146 RTC_DCHECK(!expires_ms); |
| 147 MessageData* msg = new MessageData( | 147 MessageData* msg = new MessageData( |
| 148 rtc::scoped_refptr<rtc::RTCCertificateGeneratorCallback>(callback)); | 148 rtc::scoped_refptr<rtc::RTCCertificateGeneratorCallback>(callback)); |
| 149 uint32_t msg_id; | 149 uint32_t msg_id; |
| 150 // Only supports RSA-1024-0x10001 and ECDSA-P256. | 150 // Only supports RSA-1024-0x10001 and ECDSA-P256. |
| 151 if (should_fail_) { | 151 if (should_fail_) { |
| 152 msg_id = MSG_FAILURE; | 152 msg_id = MSG_FAILURE; |
| 153 } else if (key_params.type() == rtc::KT_RSA) { | 153 } else if (key_params.type() == rtc::KT_RSA) { |
| 154 RTC_DCHECK(key_params.rsa_params().mod_size == 1024 && | 154 RTC_DCHECK_EQ(key_params.rsa_params().mod_size, 1024); |
| 155 key_params.rsa_params().pub_exp == 0x10001); | 155 RTC_DCHECK_EQ(key_params.rsa_params().pub_exp, 0x10001); |
| 156 msg_id = MSG_SUCCESS_RSA; | 156 msg_id = MSG_SUCCESS_RSA; |
| 157 } else { | 157 } else { |
| 158 RTC_DCHECK(key_params.type() == rtc::KT_ECDSA && | 158 RTC_DCHECK_EQ(key_params.type(), rtc::KT_ECDSA); |
| 159 key_params.ec_curve() == rtc::EC_NIST_P256); | 159 RTC_DCHECK_EQ(key_params.ec_curve(), rtc::EC_NIST_P256); |
| 160 msg_id = MSG_SUCCESS_ECDSA; | 160 msg_id = MSG_SUCCESS_ECDSA; |
| 161 } | 161 } |
| 162 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, msg_id, msg); | 162 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, msg_id, msg); |
| 163 } | 163 } |
| 164 | 164 |
| 165 static rtc::scoped_refptr<rtc::RTCCertificate> GenerateCertificate() { | 165 static rtc::scoped_refptr<rtc::RTCCertificate> GenerateCertificate() { |
| 166 switch (rtc::KT_DEFAULT) { | 166 switch (rtc::KT_DEFAULT) { |
| 167 case rtc::KT_RSA: | 167 case rtc::KT_RSA: |
| 168 return rtc::RTCCertificate::FromPEM(kRsaPems[0]); | 168 return rtc::RTCCertificate::FromPEM(kRsaPems[0]); |
| 169 case rtc::KT_ECDSA: | 169 case rtc::KT_ECDSA: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 delete message_data; | 223 delete message_data; |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool should_fail_; | 226 bool should_fail_; |
| 227 int key_index_ = 0; | 227 int key_index_ = 0; |
| 228 int generated_certificates_ = 0; | 228 int generated_certificates_ = 0; |
| 229 }; | 229 }; |
| 230 | 230 |
| 231 #endif // WEBRTC_PC_TEST_FAKERTCCERTIFICATEGENERATOR_H_ | 231 #endif // WEBRTC_PC_TEST_FAKERTCCERTIFICATEGENERATOR_H_ |
| OLD | NEW |