mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[ANY] Удаление хлама
This commit is contained in:
parent
4c1ba67c71
commit
7c5616ef2b
3 changed files with 0 additions and 76 deletions
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue