protected void EncryptButton_Click(object sender, EventArgs e) { DataProtectionSample encrypter = new DataProtectionSample(); string encryptedCString = encrypter.EncryptString(ConnectionString.Text); EncryptedString.Text = encryptedCString; //Response.Write("<br />"); //Response.Write(encryptedCString); }
public static void method(byte[] secret) { byte[] encryptedSecret = DataProtectionSample.Protect(secret); Console.WriteLine("The encrypted byte array is:"); DataProtectionSample.PrintValues(encryptedSecret); // Decrypt the data and store in a byte array. byte[] originalData = DataProtectionSample.Unprotect(encryptedSecret); Console.WriteLine("{0}The original data is:", Environment.NewLine); DataProtectionSample.PrintValues(originalData); Console.WriteLine(BitConverter.ToInt32(originalData, 0)); }
protected void Page_Load(object sender, EventArgs e) { //string secretString = ""; DataProtectionSample Encryption = new DataProtectionSample(); // Create a simple byte array containing data to be encrypted. byte[] secret = { 0, 1, 2, 3, 4, 1, 2, 3, 4 }; //Encrypt the data. byte[] encryptedSecret = Encryption.Protect(secret); Response.Write("The encrypted byte array is:"); Encryption.PrintValues(encryptedSecret); // Decrypt the data and store in a byte array. byte[] originalData = Encryption.Unprotect(encryptedSecret); Response.Write("The original data is:"); Encryption.PrintValues(originalData); }
private void button1_Click(object sender, EventArgs e) { DataProtectionSample.Test(); }