using System;
using System.Security;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
class Program
{
static void Main(string[] args)
{
string messageToProtect = "this is a test";
byte[] messageArray = System.Text.ASCIIEncoding.ASCII.GetBytes(messageToProtect);
ProtectedMemory.Protect(messageArray, MemoryProtectionScope.SameLogon);
Console.WriteLine(System.Text.ASCIIEncoding.ASCII.GetString(messageArray));
ProtectedMemory.Unprotect(messageArray, MemoryProtectionScope.SameLogon);
Console.WriteLine(System.Text.ASCIIEncoding.ASCII.GetString(messageArray));
}
}
|