コード例 #1
0
    public void OnCipherOverWebServerTestClick1()
    {
        StartCoroutine(Http.SendGetRequest("http://127.0.0.1:808/login", (WWW www) => {
            Debug.Log(www.text);

            MyResponse jData = Newtonsoft.Json.JsonConvert.DeserializeObject <MyResponse>(www.text);
            NetworkLib.Cryptography.RSA.PublicKey publicKey = new NetworkLib.Cryptography.RSA.PublicKey(jData.publicKeyModulus, jData.publicKeyExponent);
            byte[] encText = NetworkLib.Cryptography.RSA.Encryption("haha하하!", publicKey, false);

            string sessionId = GetSessionId(www);
            Debug.Log(sessionId);
            Dictionary <string, string> cookie = new Dictionary <string, string>();
            cookie.Add("COOKIE", sessionId);

            StartCoroutine(Http.SendPostRequest("http://127.0.0.1:808/hello", encText, cookie, (WWW www1) => {
                Debug.Log(www1.text);
            },
                                                (string err) => {
                Debug.Log(err);
            }
                                                ));
        },
                                           (string err) => {
            Debug.Log(err);
        }
                                           ));
    }
コード例 #2
0
ファイル: ButtonHandler.cs プロジェクト: yakolla/HelloVertX
	public void OnCipherOverWebServerTestClick1()
	{

		StartCoroutine (Http.SendGetRequest("http://127.0.0.1:808/login", (WWW www)=>{
			
			Debug.Log(www.text);

			MyResponse jData = Newtonsoft.Json.JsonConvert.DeserializeObject<MyResponse>(www.text);			
			NetworkLib.Cryptography.RSA.PublicKey publicKey = new NetworkLib.Cryptography.RSA.PublicKey(jData.publicKeyModulus, jData.publicKeyExponent);			
			byte[] encText = NetworkLib.Cryptography.RSA.Encryption("haha하하!", publicKey, false);

			string sessionId = GetSessionId(www);
			Debug.Log(sessionId);
			Dictionary<string, string> cookie = new Dictionary<string, string>();
			cookie.Add("COOKIE", sessionId);
			
			StartCoroutine(Http.SendPostRequest("http://127.0.0.1:808/hello", encText, cookie, (WWW www1)=>{
				Debug.Log(www1.text);
			},
			(string err)=>{
				Debug.Log(err);
			}
			));
		},
		(string err)=>{
			Debug.Log(err);
		}
		));
	}