Client certificate from local storage

Added a feature to read a client certificate from local storage.
This commit is contained in:
Akio Yamamoto 2022-07-02 16:56:00 +09:00 committed by GitHub
parent ee1b0d7ff7
commit 5efb54284d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -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);