Index: talk/app/webrtc/java/jni/peerconnection_jni.cc |
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc |
index c326ccff6bede1e3e93e5605be72be86a672df7d..ad535cde3b21b57052f3f86a63fdacf33ff7f73a 100644 |
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc |
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc |
@@ -125,6 +125,10 @@ namespace webrtc_jni { |
// Field trials initialization string |
static char *field_trials_init_string = NULL; |
+// Passed to SSLIdentity::Generate, "WebRTC". Used for the certificates' |
+// subject and issuer name. |
+static const char kIdentityName[] = "WebRTC"; |
+ |
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) |
// Set in PeerConnectionFactory_initializeAndroidGlobals(). |
static bool factory_static_initialized = false; |
@@ -1341,6 +1345,17 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)( |
rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField( |
jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); |
+ // Create ECDSA certificate. |
hbos
2015/08/26 09:50:04
This should probably not be placed here without ha
AlexG
2015/08/31 19:07:23
Done. Added Java enum to configure certificate typ
|
+ scoped_ptr<rtc::SSLIdentity> ssl_identity( |
+ rtc::SSLIdentity::Generate(kIdentityName, rtc::KT_ECDSA)); |
+ if (ssl_identity.get()) { |
+ rtc_config.certificates.push_back( |
+ rtc::RTCCertificate::Create(ssl_identity.Pass())); |
+ LOG(LS_INFO) << "ECDSA certificate created."; |
+ } else { |
+ LOG(LS_WARNING) << "Failed to generate SSLIdentity."; |
hbos
2015/08/26 09:50:04
While failing to generate is (exceptionally?) rare
AlexG
2015/08/31 19:07:23
Done. Yes, this is on purpose. I added comment and
|
+ } |
+ |
PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p); |
observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); |
rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection( |