diff options
author | syeyoung <cyong06@naver.com> | 2021-03-24 20:51:58 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-03-24 20:51:58 +0900 |
commit | 7ef6b91f1e82cb29be0a542f0cf2339123e66bf9 (patch) | |
tree | 341476fb03522af89b5c325ee011c0775137ab72 /src/main/java/kr/syeyoung/dungeonsguide/stomp | |
parent | 0fd1db8571a2215499f671b447e20f335ef6c00f (diff) | |
download | Skyblock-Dungeons-Guide-7ef6b91f1e82cb29be0a542f0cf2339123e66bf9.tar.gz Skyblock-Dungeons-Guide-7ef6b91f1e82cb29be0a542f0cf2339123e66bf9.tar.bz2 Skyblock-Dungeons-Guide-7ef6b91f1e82cb29be0a542f0cf2339123e66bf9.zip |
Jar Integrity check, + pog things
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/stomp')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java b/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java index e6626370..7e8d89f6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java @@ -22,118 +22,10 @@ import java.util.HashMap; import java.util.Map; public class StompClient extends WebSocketClient implements StompInterface { - private SSLSocketFactory getSocketfactory() throws NoSuchAlgorithmException, KeyManagementException, CertificateException, KeyStoreException, IOException { - final X509Certificate a = (X509Certificate) CertificateFactory.getInstance("X.509") - .generateCertificate(new ByteArrayInputStream(("-----BEGIN CERTIFICATE-----\n" + - "MIIEZTCCA02gAwIBAgIQQAF1BIMUpMghjISpDBbN3zANBgkqhkiG9w0BAQsFADA/\n" + - "MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n" + - "DkRTVCBSb290IENBIFgzMB4XDTIwM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sGAQUFBwMBBggrBgEFBQcDAjANBgkqhkiG9w0B\n" + - "AQsFAAOCAQEA2UzgyfWEiDcx27sT4rP8i2tiEmxYt0l+PAK3qB8oYevO4C5z70kH\n" + - "ejWEHx2taPDY/laBL21/WKZuNTYQHHPD5b1tXgHXbnL7KqC401dk5VvCadTQsvd8\n" + - "S8MXjohyc9z9/G2948kLjmE6Flh9dDYrVYA9x2O+hEPGOaEOa1eePynBgPayvUfL\n" + - "qjBstzLhWVQLGAkXXmNs+5ZnPBxzDJOLxhF2JIbeQAcH5H0tZrUlo5ZYyOqA7s9p\n" + - "O5b85o3AM/OJ+CktFBQtfvBhcJVd9wvlwPsk+uyOy2HI7mNxKKgsBTt375teA2Tw\n" + - "UdHkhVNcsAKX1H7GNNLOEADksd86wuoXvg==\n" + - "-----END CERTIFICATE-----").getBytes())); - - KeyStore b = KeyStore.getInstance(KeyStore.getDefaultType()); - b.load(null, null); - b.setCertificateEntry(Integer.toString(1), a); - - X509TrustManager trustManager = new X509ExtendedTrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] x509Certificates, String s, Socket socket) throws CertificateException { - for (X509Certificate x509Certificate : x509Certificates) { - if (x509Certificate.equals(a)) { - return; - } - } - throw new CertificateException("invalid"); - } - - @Override - public void checkServerTrusted(X509Certificate[] x509Certificates, String s, Socket socket) throws CertificateException { - - for (X509Certificate x509Certificate : x509Certificates) { - if (x509Certificate.equals(a)) { - return; - } - } - throw new CertificateException("invalid"); - } - - @Override - public void checkClientTrusted(X509Certificate[] x509Certificates, String s, SSLEngine sslEngine) throws CertificateException { - - for (X509Certificate x509Certificate : x509Certificates) { - if (x509Certificate.equals(a)) { - return; - } - } - throw new CertificateException("invalid"); - } - - @Override - public void checkServerTrusted(X509Certificate[] x509Certificates, String s, SSLEngine sslEngine) throws CertificateException { - - for (X509Certificate x509Certificate : x509Certificates) { - if (x509Certificate.equals(a)) { - return; - } - } - throw new CertificateException("invalid"); - } - - @Override - public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - for (X509Certificate x509Certificate : x509Certificates) { - if (x509Certificate.equals(a)) { - return; - } - } - throw new CertificateException("invalid"); - } - - @Override - public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - for (X509Certificate x509Certificate : x509Certificates) { - if (x509Certificate.equals(a)) { - return; - } - } - throw new CertificateException("invalid"); - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[] {a}; - } - }; - - SSLContext d = SSLContext.getInstance("TLSv1.2"); - d.init(null, new TrustManager[]{ trustManager}, null); - return d.getSocketFactory(); - } public StompClient(URI serverUri, final String token, CloseListener closeListener) throws Exception { super(serverUri); this.closeListener = closeListener; addHeader("Authorization", token); - setSocketFactory(getSocketfactory()); System.out.println("connecting websocket"); if (!connectBlocking()) { |