helping Android
This commit is contained in:
parent
09d89c8c3f
commit
1430d30bef
|
@ -16,6 +16,5 @@
|
|||
<orderEntry type="library" exported="" name="annotations" level="project" />
|
||||
<orderEntry type="module" module-name="inifile" exported="" />
|
||||
<orderEntry type="library" exported="" name="javax.json" level="project" />
|
||||
<orderEntry type="module" module-name="proxy_server" />
|
||||
</component>
|
||||
</module>
|
|
@ -8,6 +8,7 @@ import java.net.ServerSocket;
|
|||
import java.net.Socket;
|
||||
import java.security.KeyStore;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Objects;
|
||||
|
||||
public class rusEFISSLContext {
|
||||
private static final String TLS = "TLS";
|
||||
|
@ -32,7 +33,7 @@ public class rusEFISSLContext {
|
|||
|
||||
public static void init(String fileName, String password) throws MalformedURLException {
|
||||
// system property setup does not work under Jenkins?
|
||||
Backend.setupCertificates(new File(fileName), password);
|
||||
setupCertificates(new File(fileName), password);
|
||||
|
||||
//key = getFromPath(fileName, "PKCS12", password);
|
||||
}
|
||||
|
@ -86,6 +87,19 @@ public class rusEFISSLContext {
|
|||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupCertificates(File certificate, String password) throws MalformedURLException {
|
||||
if (!certificate.exists())
|
||||
throw new IllegalStateException("Certificate not found " + certificate);
|
||||
Objects.requireNonNull(password, "password");
|
||||
|
||||
String file = certificate.toURI().toURL().getFile();
|
||||
System.setProperty("javax.net.ssl.keyStore", file);
|
||||
System.setProperty("javax.net.ssl.keyStorePassword", password);
|
||||
System.setProperty("javax.net.ssl.trustStore", file);
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", password);
|
||||
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
|
||||
}
|
||||
/*
|
||||
private static KeyStore getFromPath(String path, String algorithm, String filePassword) {
|
||||
try {
|
||||
|
|
|
@ -72,19 +72,6 @@ public class Backend {
|
|||
// }, "rusEFI Server Cleanup").start();
|
||||
}
|
||||
|
||||
public static void setupCertificates(File certificate, String password) throws MalformedURLException {
|
||||
if (!certificate.exists())
|
||||
throw new IllegalStateException("Certificate not found " + certificate);
|
||||
Objects.requireNonNull(password, "password");
|
||||
|
||||
String file = certificate.toURI().toURL().getFile();
|
||||
System.setProperty("javax.net.ssl.keyStore", file);
|
||||
System.setProperty("javax.net.ssl.keyStorePassword", password);
|
||||
System.setProperty("javax.net.ssl.trustStore", file);
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", password);
|
||||
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
|
||||
}
|
||||
|
||||
public void runApplicationConnector(int serverPortForApplications, Listener serverSocketCreationCallback) {
|
||||
// connection from authenticator app which proxies for Tuner Studio
|
||||
// authenticator pushed hello packet on connect
|
||||
|
@ -235,7 +222,7 @@ public class Backend {
|
|||
}
|
||||
|
||||
public static void start(String[] args) throws MalformedURLException {
|
||||
setupCertificates(new File("keystore.jks"), System.getProperty("RUSEFI_PROXY_PASSWORD"));
|
||||
rusEFISSLContext.setupCertificates(new File("keystore.jks"), System.getProperty("RUSEFI_PROXY_PASSWORD"));
|
||||
|
||||
Function<String, UserDetails> userDetailsFunction = new JsonUserDetailsResolver();
|
||||
|
||||
|
|
Loading…
Reference in New Issue