예제 #1
0
        static void Main(string[] args)
        {
            /*******                    response decryption     **************/
            //first time
            Console.WriteLine(GzUncompress(Cipher.DecryptRJ128Byte(
                                               Cipher.DEFAULT_NETWORKHASH,
                                               Cipher.DEFAULT_IV_128,
                                               "MPOoBl31VhdEZYTkh4XsQ8bo0EsdtmNdS229zt7iibXO15yXqMsNzaR0e8wzSFsvxiTvR8CjHxTMzMD9yUcNQQ=="
                                               )));

            //otherwise

            //userHash is stored in shared_prefs using CryptoPrefs
            //<string name="md5('Account')">{"token":"wcatpt=xxx","userHash":"yyy","mailAddress":"","gmailAddress":""}</string>
            Console.WriteLine(CryptoPrefs.Decrypt("yy5spAe2Vhruecg7Zd+vm6X/KsIi/5MKVlxX9gjnBgTpd0th4eqqNM8Q0hI4gspBQd/7kW5Oa+6r8jJqR1k/YkEI5wFc1DxYwX3i7EhLfxWVv6csWaxnHDu7et7KzR4+r3Bra4W3bxcjE/p4DwK/+/CCeDzlW7Kn/O/Jn4do51NxgWIAs5U9zrcr0383qRsucXdVUAPEH3X/HpJdQNye4Gefl3FYOeeiREFQdlz5UWKysPMBhTjlaK5DTEEdbVz76ZM6BiMSvkUfJmCh6CC81xNbgaZ6GV962hl8uMQfynJcKSdRTq2swT8T/d/rh+/q"));
            Console.WriteLine(CryptoPrefs.Decrypt("W2lmvAavuGNYBBkxvCM3ubQP6ijTIan4jN8fYBnoPkv625Fi8kp48zhLn0a6ky0Jt7BVI8d+l9E8VCR0TqNvn9X01e0A4sKSLHKL8muayqhAGIPH03mo5TZh3p8b5ujM82/GJGk922DqGhOKgd9EPGoWgiuxKLxAPBhz/71rWVIVq5UliXLTpy2VFlRVqlYC9anAdJyXqEne/bjim5FbbZDSpeXWcDtYgVxxbZA69sejchju6PJ9K4P1KBEM268LxvYEudiretA1TtZ1XA9kdWhK0AisimeY5d5C/k72G8DcUPXRPaZesagqF4II/rnFOv1b2Aps25tUZrjgWlOlRvHIRGWAipsIbcG4ZYe5+TH25ALOExCXXY5LNx/epQVDtcPOa3Mqk0cpXnjDPvbX3IYEUoafyoCZjYJXo+hBIMD0IeX1b087aIvyB/oIduWYAwY9juwfJbImkJQmHswDNEJjOFQTHgte3DO+/STSyFtpF4kFHr1FJn2qiUqLV6xIFfx00H8RwWn4rADCsfFjutybDF8PhwuGcXxreQt09oawapxaXkq8uLabUwcTuUXSzN4u/WsYe2gNcTG9Szo0fT8ixJQ03QrcJ8a/gr4pKH+19d2vBquOsFR/RZz0idBmE9esZq6vHIqyVmJkdt0JW8LxUwDGdL7uK7jBcgZNJNKvojzUtgRfIc/JbgnLNWEOau5JqgnGyaocT+xdN5tH6QnTfj839HiWwYkHs7addnlO2facMuzznL60F+FOV/U1Hdmik4zk3Q7Ad1te6kPaJvIkd/aJngYu2TA1S6efZj1w3aWOpajDbUJKltdenpAs"));
            Console.WriteLine(CryptoPrefs.Decrypt("J3MGeRhm+b0HfU8fdB+BI62b4n/zRlQzMODfePSIDcwRjFsMqob224xIzfLY6kWHgm8/AZHVlJzJe1SaxoKPwdGbBdSxdW4SAx0GCpddSr19owqWxntGmUl9zxOyW35u08hDRntozrO0e8sSZe8dteOkTJTwJd3UzXUy89V5fCBZUaouSNd1lwi0vzRn/a4zcJeQjICYOcGu1ur7iJ8/1edmrEtJjhTtpbYXvI37k+lB1mpxKYX+Atu0sb1gsr86KEKVLzky4joiKTZ4G+xpSw=="));
            //use token as cookie to login
            //use userHash as Cipher.key
            Console.WriteLine(GzUncompress(Cipher.DecryptRJ128Byte(
                                               "690828c9082a6fcdfce9a910d2dfd028",//userHash
                                               Cipher.DEFAULT_IV_128,
                                               "jUL/x5jT4+anfwTcIjdFLh4YmFiK5g3Q6KU2L/lcU8VarJwLERC3RwfMbPrv2DEpHu27qJ1jy/cuqAT9jFAN9I8YNP0d3b/ihFFQJ3oKSiCmITyRsN0DKeYLhNLeglxp6H5Ap9Zc9kKOqlGNkBKL4YZgMxuiUFHkzeaQj8IJS0fDMvx5ozZUQZTLIuub99tBzQ10G6GtDqfGAHW4QBL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0GgPPUofF9hGhMrFu8uvK5cYO+E808029JRyofG342hZ9T6q7jfbWtIUB8YsYjA7e1c823BvQGS4HDZhIze7pupjiWLKa6Ghluu1g9fbKH1a/JCEW4P2EPKu43S538rY+y+xfIdrHdrHPiS8iXv+n0akDeG23vZzDXLqTunb4V3pl28jhw0I0Hrv+sT7FsopyU3ZutCVzG5FuQuUGLDXuuje3q1Vwvwa5uWsTQvMPyN0bISiMfnoe8x1gZ00L/3cD/P9bGFfQLQL2+swUTNl6oCpaRgUj8bTpbHhcsoRnj71Q1L+dFH1TzOvcothjimUok3yD7MkblSpOlf7witJ1eqk59U8GDHI4AmvBsUN7WPn79zqbjy0HEIAiT6BQHkZZXcBfK5xm74jJcD9y8d+CfEveJ5UhYVR9gnthsA/efEaTpO4/sJ/OZhEcwUOWzI14BsYTu/dPIUvfyeq5kr6qHf0l3IMvn384MKnuRd6UERQVcHqsVnisNN99c3StrMu75Hk7QhNpxJa2SnjVBmjckxFXJwajwmOb0tyiw4Pl+H4Awt0R5Ui+SfxKd1s2mFzv++A/ZCzOfe8E/pB8n+h7ENl7rjY/281sXIERLTNyfQaLm9i+iUmzSp0Jn53zW0UeydLNXfbrQneQwGikM2IsKmS4vCO9tPDOm9jgjiptU9iJ7ogPKSj7DYtmgwwNMfk1+BZ3zGQnKDbZ8oJdAY7SEid0mds4v1O862FZlfVr4JUlHTaBdWgreGkPkCSoHvvnZdC4iUP2BWkx+/BWZA7l+F+ye44XT8YqtL2kfp26vvZAJX2ObX7QmRpW0LKfs2kFXHiLfkJOWeVuwdfSh/qra3D9gTQlRcFVexL/OiZY+UF7nbzk1NYVtoV"
                                               )));

            /*******                    response signature     **************/
            // in Cipher.verify

            Console.ReadLine();
        }
 private void Login()
 {
     //IL_002b: Unknown result type (might be due to invalid IL or missing references)
     if (CryptoPrefs.GetInt("signin_game_service_auto", 0) != -1 && !isRunLogin)
     {
         isRunLogin = true;
         PlayGamesPlatform.Activate();
         Social.get_localUser().Authenticate((Action <bool>) delegate(bool success)
         {
             //IL_0016: Unknown result type (might be due to invalid IL or missing references)
             //IL_001b: Expected O, but got Unknown
             if (success)
             {
                 CryptoPrefs.SetInt("signin_game_service_auto", 1);
             }
             else
             {
                 ((PlayGamesLocalUser)Social.get_localUser()).GetStats(delegate(CommonStatusCodes rc, PlayerStats stats)
                 {
                     if (rc == CommonStatusCodes.SignInRequired || rc == CommonStatusCodes.ServiceDisabled)
                     {
                         if (CryptoPrefs.GetInt("signin_game_service_auto", 0) != 1)
                         {
                             CryptoPrefs.SetInt("signin_game_service_auto", -1);
                         }
                     }
                     else
                     {
                         CryptoPrefs.SetInt("signin_game_service_auto", 2);
                     }
                 });
             }
         });
     }
 }
예제 #3
0
    public void SetMaxPassLevel(int Value)
    {
        int level = Mathf.Max(Value, this.GetCurrentLevel());

        CryptoPrefs.SetInt("PassLevel", level);
        return;
    }
예제 #4
0
    public static float GetFloat(string key, float defaultValue = 0f)
    {
        string @string = CryptoPrefs.GetString(key, defaultValue.ToString());
        float  result  = defaultValue;

        float.TryParse(@string, out result);
        return(result);
    }
예제 #5
0
 public static void Save()
 {
     foreach (KeyValuePair <string, string> item in m_SaveDataString)
     {
         CryptoPrefs.SetString(item.Key, item.Value);
     }
     CryptoPrefs.Save();
 }
 public void SignInFirstTime()
 {
     if (!isConnected() && isFirstRun)
     {
         CryptoPrefs.SetInt("signin_game_service_auto", 2);
         Login();
     }
 }
예제 #7
0
    public static int GetInt(string key, int defaultValue = 0)
    {
        string @string = CryptoPrefs.GetString(key, defaultValue.ToString());
        int    result  = defaultValue;

        int.TryParse(@string, out result);
        return(result);
    }
예제 #8
0
    public static string GetString(string key, string defaultValue = "")
    {
        string text    = defaultValue;
        string @string = PlayerPrefs.GetString(CryptoPrefs.GetHash(key), defaultValue.ToString());

        if (!text.Equals(@string))
        {
            text = CryptoPrefs.Decrypt(@string);
        }
        return(text);
    }
예제 #9
0
    private static string GetString(Key key, string defaultValue = "")
    {
        object result;

        if (m_SaveDataString.ContainsKey(key.ToString()))
        {
            result = m_SaveDataString[key.ToString()];
        }
        else
        {
            string @string = CryptoPrefs.GetString(key.ToString(), defaultValue);
            m_SaveDataString[key.ToString()] = @string;
            result = @string;
        }
        return((string)result);
    }
    private new void Awake()
    {
        switch (CryptoPrefs.GetInt("signin_game_service_auto", 0))
        {
        case -1:
            return;

        case 0:
            isFirstRun = true;
            break;

        default:
            isFirstRun = false;
            break;
        }
        InitData();
    }
예제 #11
0
 public static void DeleteAll()
 {
     m_SaveDataString.Clear();
     CryptoPrefs.DeleteAll();
 }
예제 #12
0
 public static void DeleteKey(Key key)
 {
     m_SaveDataString.Remove(key.ToString());
     CryptoPrefs.DeleteKey(key.ToString());
     PlayerPrefs.DeleteKey(key.ToString());
 }
예제 #13
0
    public static void DeleteKey(string key)
    {
        string hash = CryptoPrefs.GetHash(key);

        PlayerPrefs.DeleteKey(hash);
    }
예제 #14
0
 public static void SetInt(string key, int val)
 {
     PlayerPrefs.SetString(CryptoPrefs.GetHash(key), CryptoPrefs.Encrypt(val.ToString()));
 }
예제 #15
0
    public static bool HasKey(string key)
    {
        string hash = CryptoPrefs.GetHash(key);

        return(PlayerPrefs.HasKey(hash));
    }
예제 #16
0
    public void init()
    {
        CryptoPrefs.SetInt("PassLevel", 1);

        CryptoPrefs.Save();
    }
예제 #17
0
 public static void SetString(string key, string val)
 {
     PlayerPrefs.SetString(CryptoPrefs.GetHash(key), CryptoPrefs.Encrypt(val));
 }
예제 #18
0
 public int GetCurrentLevel()
 {
     return(CryptoPrefs.GetInt("PassLevel"));
 }
예제 #19
0
 public static bool HasKey(Key key)
 {
     return(m_SaveDataString.ContainsKey(key.ToString()) || CryptoPrefs.HasKey(key.ToString()) || PlayerPrefs.HasKey(key.ToString()));
 }