JNI+mm: Generate certificate if non-default key type is specified.

By comparing key type with KT_DEFAULT we remove the implicit assumption that
the default is RSA.

Removing the assumptions about what the default is is necessary for a
follow-up CL that will change the default.

BUG=webrtc:5795, webrtc:5707
R=hta@webrtc.org, magjed@webrtc.org, tommi@webrtc.org
TBR=tkchin@webrtc.org

Review URL: https://codereview.webrtc.org/1965313002 .

Cr-Commit-Position: refs/heads/master@{#12722}
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
index 3b7632c..57c6780 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
@@ -197,14 +197,16 @@
                     constraints:(RTCMediaConstraints *)constraints
                        delegate:(id<RTCPeerConnectionDelegate>)delegate {
   NSParameterAssert(factory);
+  std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config(
+      configuration.nativeConfiguration);
+  if (!config)
+    return nullptr;
   if (self = [super init]) {
     _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self));
-    webrtc::PeerConnectionInterface::RTCConfiguration config =
-        configuration.nativeConfiguration;
     std::unique_ptr<webrtc::MediaConstraints> nativeConstraints =
         constraints.nativeConstraints;
     _peerConnection =
-        factory.nativeFactory->CreatePeerConnection(config,
+        factory.nativeFactory->CreatePeerConnection(*config,
                                                     nativeConstraints.get(),
                                                     nullptr,
                                                     nullptr,
@@ -251,7 +253,11 @@
 }
 
 - (BOOL)setConfiguration:(RTCConfiguration *)configuration {
-  return _peerConnection->SetConfiguration(configuration.nativeConfiguration);
+  std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config(
+      configuration.nativeConfiguration);
+  if (!config)
+    return false;
+  return _peerConnection->SetConfiguration(*config);
 }
 
 - (void)close {