[ANY] Удаление хлама

This commit is contained in:
Gravit 2019-10-17 20:29:28 +07:00
parent 4c1ba67c71
commit 7c5616ef2b
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 0 additions and 76 deletions

View file

@ -1,19 +0,0 @@
package pro.gravit.launcher.ssl;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
public class LauncherKeyStore {
public static KeyStore getKeyStore(String keystore, String password) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {
KeyStore ks = KeyStore.getInstance("JKS");
try (InputStream ksIs = new FileInputStream(keystore)) {
ks.load(ksIs, password.toCharArray());
}
return ks;
}
}

View file

@ -1,42 +0,0 @@
package pro.gravit.launcher.ssl;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
public class LauncherSSLContext {
public SSLServerSocketFactory ssf;
public SSLSocketFactory sf;
public LauncherSSLContext(KeyStore ks, String keypassword) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, KeyManagementException {
TrustManager[] trustAllCerts = new TrustManager[]{
new LauncherTrustManager()
};
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
.getDefaultAlgorithm());
kmf.init(ks, keypassword.toCharArray());
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(kmf.getKeyManagers(), trustAllCerts, new SecureRandom());
ssf = sc.getServerSocketFactory();
sf = sc.getSocketFactory();
}
public LauncherSSLContext() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager[] trustAllCerts = new TrustManager[]{
new LauncherTrustManager()
};
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, trustAllCerts, new SecureRandom());
ssf = null;
sf = sc.getSocketFactory();
}
}

View file

@ -1,15 +0,0 @@
package pro.gravit.launcher.ssl;
import javax.net.ssl.X509TrustManager;
public class LauncherTrustManager implements X509TrustManager {
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
}