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

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: 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..654e5a01e2c5bffb6846aa20e984d6923095a98b 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -93,6 +93,7 @@ using rtc::Bind;
using rtc::Thread;
using rtc::ThreadManager;
using rtc::scoped_ptr;
+using rtc::scoped_refptr;
using webrtc::AudioSourceInterface;
using webrtc::AudioTrackInterface;
using webrtc::AudioTrackVector;
@@ -125,6 +126,9 @@ namespace webrtc_jni {
// Field trials initialization string
static char *field_trials_init_string = NULL;
+// ECSDA certificate
+static scoped_refptr<rtc::RTCCertificate> g_rtc_certificate;
+
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
// Set in PeerConnectionFactory_initializeAndroidGlobals().
static bool factory_static_initialized = false;
@@ -132,6 +136,7 @@ static bool vp8_hw_acceleration_enabled = true;
#endif
extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
+ LOG(LS_INFO) << "JNI_OnLoad";
jint ret = InitGlobalJniVariables(jvm);
if (ret < 0)
return -1;
@@ -139,6 +144,15 @@ extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()";
LoadGlobalClassReferenceHolder();
+ scoped_ptr<rtc::SSLIdentity> ssl_identity(
+ rtc::SSLIdentity::Generate(std::string(), rtc::KT_ECDSA));
+ if (ssl_identity.get()) {
+ g_rtc_certificate = rtc::RTCCertificate::Create(ssl_identity.Pass());
jiayl2 2015/08/25 23:06:02 If the app runs for days or months, the certificat
AlexG 2015/08/25 23:15:26 ok. Should I call both rtc::SSLIdentity::Generate(
AlexG 2015/08/25 23:56:02 Done.
+ LOG(LS_INFO) << "ECDSA certificate created.";
+ } else {
+ LOG(LS_WARNING) << "Failed to generate SSLIdentity.";
+ }
+
return ret;
}
@@ -1340,6 +1354,8 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id);
rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField(
jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id);
+ if (g_rtc_certificate.get() != NULL)
+ rtc_config.certificates.push_back(g_rtc_certificate);
PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p);
observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints));
« 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