From 5efb54284d09b6b9d528df7652e340409d7701a4 Mon Sep 17 00:00:00 2001 From: Akio Yamamoto Date: Sat, 2 Jul 2022 16:56:00 +0900 Subject: [PATCH] Client certificate from local storage Added a feature to read a client certificate from local storage. --- .../com/pichillilorenzo/flutter_inappwebview/Util.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/Util.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/Util.java index fceaffbf..485297a1 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/Util.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/Util.java @@ -19,6 +19,7 @@ import org.json.JSONObject; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.FileInputStream; import java.net.Inet6Address; import java.net.InetAddress; import java.net.UnknownHostException; @@ -141,7 +142,13 @@ public class Util { PrivateKeyAndCertificates privateKeyAndCertificates = null; try { - InputStream certificateFileStream = getFileAsset(plugin, certificatePath); + InputStream certificateFileStream = null; + if(certificatePath.startsWith("/") == true) { + certificateFileStream = new FileInputStream(certificatePath); + } + else { + certificateFileStream = getFileAsset(plugin, certificatePath); + } KeyStore keyStore = KeyStore.getInstance(keyStoreType); keyStore.load(certificateFileStream, certificatePassword != null ? certificatePassword.toCharArray() : null);