VSNDK.DebugEngine.AD7PortSupplier.Decrypt C# (CSharp) Method

Decrypt() public method

Decrypts a given string.
Keep in mind that the decrypted string remains in memory and makes your application vulnerable per se. If runtime protection is essential, SecureString should be used.
If /// is a null reference.
public Decrypt ( string cipher ) : string
cipher string A base64 encoded string that was created /// through the or /// extension methods.
return string
        public string Decrypt(string cipher)
        {
            if (cipher == null) throw new ArgumentNullException("cipher");

            //parse base64 string
            byte[] data = Convert.FromBase64String(cipher);

            //decrypt data
            byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine);

            return Encoding.Unicode.GetString(decrypted);
        }