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 |
11 #ifndef WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 11 #ifndef WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
12 #define WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 12 #define WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
13 | 13 |
| 14 #include <memory> |
14 #include <string> | 15 #include <string> |
15 #include <utility> | 16 #include <utility> |
16 | 17 |
17 #include "webrtc/api/dtlsidentitystore.h" | 18 #include "webrtc/api/dtlsidentitystore.h" |
18 #include "webrtc/api/peerconnectioninterface.h" | 19 #include "webrtc/api/peerconnectioninterface.h" |
19 #include "webrtc/base/rtccertificate.h" | 20 #include "webrtc/base/rtccertificate.h" |
20 | 21 |
21 static const struct { | 22 static const struct { |
22 const char* rsa_private_key_pem; | 23 const char* rsa_private_key_pem; |
23 const char* cert_pem; | 24 const char* cert_pem; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 kKeysAndCerts[0].rsa_private_key_pem, &key); | 121 kKeysAndCerts[0].rsa_private_key_pem, &key); |
121 | 122 |
122 std::string pem_cert = rtc::SSLIdentity::DerToPem( | 123 std::string pem_cert = rtc::SSLIdentity::DerToPem( |
123 rtc::kPemTypeCertificate, | 124 rtc::kPemTypeCertificate, |
124 reinterpret_cast<const unsigned char*>(cert.data()), | 125 reinterpret_cast<const unsigned char*>(cert.data()), |
125 cert.length()); | 126 cert.length()); |
126 std::string pem_key = rtc::SSLIdentity::DerToPem( | 127 std::string pem_key = rtc::SSLIdentity::DerToPem( |
127 rtc::kPemTypeRsaPrivateKey, | 128 rtc::kPemTypeRsaPrivateKey, |
128 reinterpret_cast<const unsigned char*>(key.data()), | 129 reinterpret_cast<const unsigned char*>(key.data()), |
129 key.length()); | 130 key.length()); |
130 rtc::scoped_ptr<rtc::SSLIdentity> identity( | 131 std::unique_ptr<rtc::SSLIdentity> identity( |
131 rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert)); | 132 rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert)); |
132 | 133 |
133 return rtc::RTCCertificate::Create(std::move(identity)); | 134 return rtc::RTCCertificate::Create(std::move(identity)); |
134 } | 135 } |
135 | 136 |
136 private: | 137 private: |
137 enum { | 138 enum { |
138 MSG_SUCCESS, | 139 MSG_SUCCESS, |
139 MSG_FAILURE, | 140 MSG_FAILURE, |
140 }; | 141 }; |
(...skipping 22 matching lines...) Expand all Loading... |
163 break; | 164 break; |
164 } | 165 } |
165 delete message_data; | 166 delete message_data; |
166 } | 167 } |
167 | 168 |
168 bool should_fail_; | 169 bool should_fail_; |
169 int key_index_ = 0; | 170 int key_index_ = 0; |
170 }; | 171 }; |
171 | 172 |
172 #endif // WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 173 #endif // WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
OLD | NEW |