Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit 63decfa

Browse files
author
Checkium
committed
Fixed error caused by vhack.com certeficate change. (Again)
1 parent 1ca80ce commit 63decfa

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/me/checkium/vhackapi/Utils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import java.io.Reader;
88
import java.net.URL;
99
import java.nio.charset.Charset;
10+
import java.security.GeneralSecurityException;
1011
import java.security.MessageDigest;
1112
import java.security.NoSuchAlgorithmException;
1213
import java.security.cert.X509Certificate;
1314

15+
import javax.net.ssl.HttpsURLConnection;
16+
import javax.net.ssl.SSLContext;
1417
import javax.net.ssl.TrustManager;
1518
import javax.net.ssl.X509TrustManager;
1619

@@ -43,13 +46,13 @@ public static String readJson(Reader rd) throws IOException {
4346

4447
public static JSONObject JSONRequest(String format, String data, String php){
4548
System.setProperty("http.agent", "Chrome");
46-
/* try {
49+
try {
4750
SSLContext sc = SSLContext.getInstance("SSL");
4851
sc.init(null, Utils.trustAllCerts, new java.security.SecureRandom());
4952
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
5053
} catch (GeneralSecurityException e) {
5154
}
52-
*/
55+
5356
JSONObject json = null;
5457
InputStream is;
5558
try {

src/me/checkium/vhackapi/vHackAPIBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public vHackAPIBuilder email(String email) {
2424
}
2525

2626
public vHackAPIBuilder register() {
27+
2728
JSONObject json = Utils.JSONRequest("user::::pass::::email", username + "::::" + password + "::::" + email, "vh_register.php");
2829

2930
if (json.getString("result") != "0") {
@@ -32,6 +33,9 @@ public vHackAPIBuilder register() {
3233
return this;
3334
}
3435
}
36+
37+
38+
3539
public vHackAPI getAPI() {
3640

3741
vHackAPI api = new vHackAPI(username, password);

0 commit comments

Comments
 (0)