Last active
April 18, 2017 08:03
-
-
Save twsiyuan/17bbedc7360b6b3cc0c8e9cfd7f53114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void DecodeTEST(string uri, string bearer) | |
{ | |
var u = new System.Uri(uri, System.UriKind.RelativeOrAbsolute); | |
var args = HttpUtility.ParseQueryString(u.Query).Get("args"); | |
Debug.Log("READ Query: args = " + args); | |
using (var aes = new AesCryptoServiceProvider()) | |
{ | |
aes.Mode = CipherMode.CBC; | |
aes.BlockSize = 128; | |
aes.IV = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, }; | |
using (var md5 = MD5.Create()) | |
{ | |
aes.Key = md5.ComputeHash(Encoding.UTF8.GetBytes(bearer)); | |
} | |
using (var ms = new System.IO.MemoryStream()) | |
{ | |
using (var cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write)) | |
{ | |
var b = System.Convert.FromBase64String(args); | |
cs.Write(b, 0, b.Length); | |
} | |
var decode = Encoding.UTF8.GetString(ms.GetBuffer()); | |
Debug.Log("DECODE Query: " + decode); | |
var ds = HttpUtility.ParseQueryString(decode); | |
for (int i = 0; i < ds.Count; i++) | |
{ | |
Debug.Log(ds.GetKey(i) + ": " + ds.Get(i)); | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "http://example.com:80/?args=QoSiR2w1QWf4fsgYsTuGocd6k%2BkQz55rN164cVJD2hZ3u3lBYrU4B9nQ3XB0%2F%2Bt%2FEGDXDiIb7UASdE8jYcePkJpnYzjb%2FFNmuWQgh0YrRTNXX%2FxciIcHVxpsOzxKmQ%2BrhLqBLp9iFbPgzG8ZRR8%2F%2BCmRyZmuU%2BqSP%2B8SEP%2FmAeg%3D"; | |
var bearer = "DB270E0074BAD27C1177F31627818618"; | |
DecodeTEST(url, bearer); | |
// DECODE Query: bearer=DB270E0074BAD27C1177F31627818618&time=4/18/2017 3:13:22 PM&salt=p70hmLGa/EDgmfmKxLwXqDORm1pZ/g2Y+ivtiwwurlk= | |
// bearer: DB270E0074BAD27C1177F31627818618 | |
// time: 4/18/2017 3:13:22 PM | |
// salt: p70hmLGa/EDgmfmKxLwXqDORm1pZ/g2Y ivtiwwurlk= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment