CmisSync.Auth.Crypto.UnixObfuscate C# (CSharp) Метод

UnixObfuscate() приватный статический Метод

Obfuscate a string on Unix. AES is used.
private static UnixObfuscate ( string value ) : string
value string The string to obfuscate
Результат string
        private static string UnixObfuscate(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 encryptor = myAes.CreateEncryptor())
                    {
                        byte[] data = System.Text.Encoding.UTF8.GetBytes(value);
                        byte[] crypt = encryptor.TransformFinalBlock(data, 0, data.Length);
                        return Convert.ToBase64String(crypt, Base64FormattingOptions.None);
                    }
                }
            }

            catch (CryptographicException e)
            {
                Console.WriteLine("Data was not encrypted. An error occurred.");
                Console.WriteLine(e.ToString());
                return null;
            }
#else
            throw new ApplicationException("Should never be reached");
#endif
        }