Esempio n. 1
0
        private static string DecryptPassword(string encryptedPassword, byte[] passwordKey)
        {
            Tuple <byte[], byte[]> passwordParts = SplitEncryptedPassword(encryptedPassword);

            byte[] decrypted = PasswordFunctions.DecryptByKey(passwordParts.Item2, passwordParts.Item1, passwordKey);
            return(Encoding.Unicode.GetString(decrypted));
        }
Esempio n. 2
0
        private static string EncryptPassword(string password, byte[] passwordKey, byte[] initializationVector)
        {
            var passwordBytes     = Encoding.Unicode.GetBytes(password);
            var encryptedPassword = PasswordFunctions.EncryptByKey(passwordBytes, initializationVector, passwordKey);

            return(ConcatenatePasswordPartsToText(initializationVector, encryptedPassword));
        }