Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: talk/app/webrtc/java/jni/peerconnection_jni.cc

Issue 1312293003: Add option to enable ECDSA key for Java API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add identity string id Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698