Permalink
Browse files

Fixed login SSL error.

  • Loading branch information...
sk89q committed Nov 30, 2013
1 parent 83bb2de commit c88f1b7781ef3f616b0a4b0a4185c14efcd88ee2
Showing with 2 additions and 19 deletions.
  1. +2 −19 src/main/java/com/sk89q/mclauncher/session/LegacySession.java
@@ -18,23 +18,17 @@
package com.sk89q.mclauncher.session;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
-import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-
-import com.sk89q.mclauncher.Launcher;
-import com.sk89q.mclauncher.security.X509KeyRing.Ring;
-
/**
* Manages a login session.
*/
@@ -75,15 +69,8 @@ public void login(String password) throws IOException,
URLEncoder.encode(password, "UTF-8"),
URLEncoder.encode(LAUNCHER_VERSION, "UTF-8"));
- TrustManager[] trustManagers = new TrustManager[] {
- Launcher.getInstance().getKeyRing().getKeyStore(Ring.MINECRAFT_LOGIN)
- };
-
try {
conn = (HttpsURLConnection) loginURL.openConnection();
- SSLContext ctx = SSLContext.getInstance("TLS");
- ctx.init(null, trustManagers, null);
- conn.setSSLSocketFactory(ctx.getSocketFactory());
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
@@ -141,10 +128,6 @@ public void login(String password) throws IOException,
throw new LoginException(result.trim());
}
}
- } catch (KeyManagementException e) {
- throw new LoginException("Failed to process PKI keys: " + e.getMessage(), e);
- } catch (NoSuchAlgorithmException e) {
- throw new LoginException("Failed to initiate TLS: " + e.getMessage(), e);
} finally {
if (conn != null) conn.disconnect();
conn = null;

0 comments on commit c88f1b7

Please sign in to comment.