From 9364f43c52757c2776eb8ed5aff352b559215294 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 20 Aug 2019 18:07:12 -0700 Subject: [PATCH] Allow pinning an existing trusted cert for testing --- .../com/limelight/preferences/AddComputerManually.java | 9 +++++++++ moonlight-common | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/limelight/preferences/AddComputerManually.java b/app/src/main/java/com/limelight/preferences/AddComputerManually.java index 8fd582da..114a47e7 100644 --- a/app/src/main/java/com/limelight/preferences/AddComputerManually.java +++ b/app/src/main/java/com/limelight/preferences/AddComputerManually.java @@ -1,5 +1,6 @@ package com.limelight.preferences; +import java.io.IOException; import java.net.Inet4Address; import java.net.InetAddress; import java.net.InterfaceAddress; @@ -9,9 +10,11 @@ import java.net.UnknownHostException; import java.util.Collections; import java.util.concurrent.LinkedBlockingQueue; +import com.limelight.binding.PlatformBinding; import com.limelight.computers.ComputerManagerService; import com.limelight.R; import com.limelight.nvstream.http.ComputerDetails; +import com.limelight.nvstream.http.NvHTTP; import com.limelight.utils.Dialog; import com.limelight.utils.SpinnerDialog; import com.limelight.utils.UiHelper; @@ -101,6 +104,12 @@ public class AddComputerManually extends Activity { try { ComputerDetails details = new ComputerDetails(); details.manualAddress = host; + + try { + NvHTTP http = new NvHTTP(host, managerBinder.getUniqueId(), null, PlatformBinding.getCryptoProvider(this)); + details.serverCert = http.getCertificateIfTrusted(); + } catch (IOException ignored) {} + success = managerBinder.addComputerBlocking(details); } catch (IllegalArgumentException e) { // This can be thrown from OkHttp if the host fails to canonicalize to a valid name. diff --git a/moonlight-common b/moonlight-common index 2cf6f808..fb288fa9 160000 --- a/moonlight-common +++ b/moonlight-common @@ -1 +1 @@ -Subproject commit 2cf6f8082e8cce94f94f52a9b2a7bbc368fbf865 +Subproject commit fb288fa95d2ab8498c907daec88b357dd73ca59c