Exemplo n.º 1
0
        private static byte[] DecryptByteArrayValue(string key, string encryptedInput, byte defaultValue, int defaultLength)
        {
            if (encryptedInput.IndexOf(':') <= -1)
            {
                return(ObscuredPrefs.DecryptData(key, encryptedInput) ?? ObscuredPrefs.ConstructByteArray(defaultValue, defaultLength));
            }
            string s = ObscuredPrefs.DeprecatedDecryptValue(encryptedInput);

            if (s == string.Empty)
            {
                return(ObscuredPrefs.ConstructByteArray(defaultValue, defaultLength));
            }
            byte[] bytes = Encoding.UTF8.GetBytes(s);
            ObscuredPrefs.SetByteArray(key, bytes);
            return(bytes);
        }
Exemplo n.º 2
0
 private static byte[] DecryptByteArrayValue(string key, string encryptedInput, byte defaultValue, int defaultLength)
 {
     if (encryptedInput.IndexOf(':') > -1)
     {
         string text = ObscuredPrefs.DeprecatedDecryptValue(encryptedInput);
         if (text == string.Empty)
         {
             return(ObscuredPrefs.ConstructByteArray(defaultValue, defaultLength));
         }
         byte[] bytes = Encoding.UTF8.GetBytes(text);
         ObscuredPrefs.SetByteArray(key, bytes);
         return(bytes);
     }
     else
     {
         byte[] array = ObscuredPrefs.DecryptData(key, encryptedInput);
         if (array == null)
         {
             return(ObscuredPrefs.ConstructByteArray(defaultValue, defaultLength));
         }
         return(array);
     }
 }