OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #ifndef TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 28 #ifndef TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
29 #define TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 29 #define TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
30 | 30 |
31 #include <string> | 31 #include <string> |
| 32 #include <utility> |
32 | 33 |
33 #include "talk/app/webrtc/dtlsidentitystore.h" | 34 #include "talk/app/webrtc/dtlsidentitystore.h" |
34 #include "talk/app/webrtc/peerconnectioninterface.h" | 35 #include "talk/app/webrtc/peerconnectioninterface.h" |
35 #include "webrtc/base/rtccertificate.h" | 36 #include "webrtc/base/rtccertificate.h" |
36 | 37 |
37 static const struct { | 38 static const struct { |
38 const char* rsa_private_key_pem; | 39 const char* rsa_private_key_pem; |
39 const char* cert_pem; | 40 const char* cert_pem; |
40 } kKeysAndCerts[] = { | 41 } kKeysAndCerts[] = { |
41 {"-----BEGIN RSA PRIVATE KEY-----\n" | 42 {"-----BEGIN RSA PRIVATE KEY-----\n" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 rtc::kPemTypeCertificate, | 135 rtc::kPemTypeCertificate, |
135 reinterpret_cast<const unsigned char*>(cert.data()), | 136 reinterpret_cast<const unsigned char*>(cert.data()), |
136 cert.length()); | 137 cert.length()); |
137 std::string pem_key = rtc::SSLIdentity::DerToPem( | 138 std::string pem_key = rtc::SSLIdentity::DerToPem( |
138 rtc::kPemTypeRsaPrivateKey, | 139 rtc::kPemTypeRsaPrivateKey, |
139 reinterpret_cast<const unsigned char*>(key.data()), | 140 reinterpret_cast<const unsigned char*>(key.data()), |
140 key.length()); | 141 key.length()); |
141 rtc::scoped_ptr<rtc::SSLIdentity> identity( | 142 rtc::scoped_ptr<rtc::SSLIdentity> identity( |
142 rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert)); | 143 rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert)); |
143 | 144 |
144 return rtc::RTCCertificate::Create(identity.Pass()); | 145 return rtc::RTCCertificate::Create(std::move(identity)); |
145 } | 146 } |
146 | 147 |
147 private: | 148 private: |
148 enum { | 149 enum { |
149 MSG_SUCCESS, | 150 MSG_SUCCESS, |
150 MSG_FAILURE, | 151 MSG_FAILURE, |
151 }; | 152 }; |
152 | 153 |
153 const char* get_key() { | 154 const char* get_key() { |
154 return kKeysAndCerts[key_index_].rsa_private_key_pem; | 155 return kKeysAndCerts[key_index_].rsa_private_key_pem; |
(...skipping 19 matching lines...) Expand all Loading... |
174 break; | 175 break; |
175 } | 176 } |
176 delete message_data; | 177 delete message_data; |
177 } | 178 } |
178 | 179 |
179 bool should_fail_; | 180 bool should_fail_; |
180 int key_index_ = 0; | 181 int key_index_ = 0; |
181 }; | 182 }; |
182 | 183 |
183 #endif // TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 184 #endif // TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
OLD | NEW |