private static string UnixDeobfuscate(string value)
{
#if __MonoCS__
try
{
using (PasswordDeriveBytes pdb = new PasswordDeriveBytes(
GetCryptoKey(), new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }))
using (AesManaged myAes = new AesManaged())
{
myAes.Key = pdb.GetBytes(myAes.KeySize / 8);
myAes.IV = pdb.GetBytes(myAes.BlockSize / 8);
using (ICryptoTransform decryptor = myAes.CreateDecryptor())
{
byte[] data = Convert.FromBase64String(value);
byte[] uncrypt = decryptor.TransformFinalBlock(data, 0, data.Length);
return System.Text.Encoding.UTF8.GetString(uncrypt);
}
}
}
catch (Exception e)
{
if (e is CryptographicException || e is FormatException)
{
Console.WriteLine("Your password is not obfuscated yet.");
Console.WriteLine("Using unobfuscated value directly might be deprecated soon, so please delete your local directories and recreate them. Thank you for your understanding.");
return value;
}
else
{
throw;
}
}
#else
throw new ApplicationException("Should never be reached");
#endif
}