Chromium Code Reviews| Index: webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
| diff --git a/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm b/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
| index b006319cae43ae81e1556cd9035b9051b1a16b62..dbe7b53034fc655c28ef37c0baf7080c79e86789 100644 |
| --- a/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
| +++ b/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
| @@ -15,6 +15,7 @@ |
| #import "RTCIceServer+Private.h" |
| #import "WebRTC/RTCLogging.h" |
| +#include "webrtc/base/rtccertificategenerator.h" |
| #include "webrtc/base/sslidentity.h" |
| @implementation RTCConfiguration |
| @@ -86,15 +87,15 @@ |
| _iceConnectionReceivingTimeout; |
| nativeConfig.ice_backup_candidate_pair_ping_interval = |
| _iceBackupCandidatePairPingInterval; |
| - if (_keyType == RTCEncryptionKeyTypeECDSA) { |
| - std::unique_ptr<rtc::SSLIdentity> identity( |
| - rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA)); |
| - if (identity) { |
| - nativeConfig.certificates.push_back( |
| - rtc::RTCCertificate::Create(std::move(identity))); |
| - } else { |
| - RTCLogWarning(@"Failed to generate ECDSA identity. RSA will be used."); |
| - } |
| + rtc::KeyType keyType = |
| + [[self class] nativeEncryptionKeyTypeForKeyType:_keyType]; |
| + // Generate non-default certificate. |
| + if (keyType != rtc::KT_DEFAULT) { |
| + rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
| + rtc::RTCCertificateGenerator::GenerateCertificate( |
| + rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); |
| + RTC_CHECK(certificate); |
|
hbos
2016/05/12 08:27:08
Here I still crash though. Since it is converting
hbos
2016/05/12 08:39:08
Wait let me see if I can make setConfiguration ret
|
| + nativeConfig.certificates.push_back(certificate); |
| } |
| return nativeConfig; |
| @@ -215,6 +216,16 @@ |
| } |
| } |
| ++ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType: |
| + (RTCEncryptionKeyType)keyType { |
| + switch (keyType) { |
| + case RTCEncryptionKeyTypeRSA: |
| + return rtc::KT_RSA; |
| + case RTCEncryptionKeyTypeECDSA: |
| + return rtc::KT_ECDSA; |
| + } |
| +} |
| + |
| + (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativePolicy: |
| (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativePolicy { |
| switch (nativePolicy) { |