Commit 7f7dbe73 authored by nanahira's avatar nanahira

toss in mycard certificate

parent 7fa5ed81
...@@ -337,7 +337,7 @@ public class Program : MonoBehaviour ...@@ -337,7 +337,7 @@ public class Program : MonoBehaviour
#elif UNITY_IPHONE //iPhone #elif UNITY_IPHONE //iPhone
string GamePaths = Application.persistentDataPath + "/ygopro2/"; string GamePaths = Application.persistentDataPath + "/ygopro2/";
if (!File.Exists(GamePaths + "updates/version2.4.txt")) if (!File.Exists(GamePaths + "updates/version2.5.txt"))
{ {
string filePath = Application.streamingAssetsPath + "/ygopro2-data.zip"; string filePath = Application.streamingAssetsPath + "/ygopro2-data.zip";
ExtractZipFile(System.IO.File.ReadAllBytes(filePath), GamePaths); ExtractZipFile(System.IO.File.ReadAllBytes(filePath), GamePaths);
......
...@@ -52,7 +52,12 @@ public class MatchObject : JSONObject { ...@@ -52,7 +52,12 @@ public class MatchObject : JSONObject {
public class MyCardHelper { public class MyCardHelper {
string username = null; string username = null;
int userid = -1; int userid = -1;
X509Certificate Cert;
public MyCardHelper() {
byte[] cert_buffer = Encoding.UTF8.GetBytes(mycard_cert);
Cert = new X509Certificate("cert/mycard.cer");
}
public bool login(string name, string password, out string fail_reason) { public bool login(string name, string password, out string fail_reason) {
try { try {
LoginRequest data = new LoginRequest(name, password); LoginRequest data = new LoginRequest(name, password);
...@@ -61,6 +66,7 @@ public class MyCardHelper { ...@@ -61,6 +66,7 @@ public class MyCardHelper {
request.Method = "POST"; request.Method = "POST";
request.ContentType = "application/json"; request.ContentType = "application/json";
request.ContentLength = Encoding.UTF8.GetByteCount(data_str); request.ContentLength = Encoding.UTF8.GetByteCount(data_str);
request.ClientCertificates.Add(Cert);
Stream request_stream = request.GetRequestStream(); Stream request_stream = request.GetRequestStream();
StreamWriter stream_writer = new StreamWriter(request_stream, Encoding.UTF8); StreamWriter stream_writer = new StreamWriter(request_stream, Encoding.UTF8);
stream_writer.Write(data_str); stream_writer.Write(data_str);
...@@ -104,6 +110,7 @@ public class MyCardHelper { ...@@ -104,6 +110,7 @@ public class MyCardHelper {
request.Method = "POST"; request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded"; request.ContentType = "application/x-www-form-urlencoded";
request.Headers.Add("Authorization", auth_str); request.Headers.Add("Authorization", auth_str);
request.ClientCertificates.Add(Cert);
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); HttpWebResponse response = (HttpWebResponse)request.GetResponse();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment