<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
// Encrypt with Rijndael (hexadecimal output)
if (this.TextBox1.Text.Length > 0)
{
LLCryptoLib.Crypto.TextCrypter crypter =
LLCryptoLib.Crypto.TextCrypterFactory.Create(
LLCryptoLib.Crypto.SupportedTextAlgorithms.RIJNDAEL,
new LLCryptoLib.Crypto.TextAlgorithmParameters("password"));
string encText = crypter.HexEncryptDecrypt(this.TextBox1.Text, true, LLCryptoLib.HexStyle.UNIX);
this.TextBox2.Text = encText;
this.TextBox1.Text = "";
}
// Decrypt Rijndael in hexadecimal text format
else if (this.TextBox2.Text.Length > 0)
{
LLCryptoLib.Crypto.TextCrypter crypter =
LLCryptoLib.Crypto.TextCrypterFactory.Create(
LLCryptoLib.Crypto.SupportedTextAlgorithms.RIJNDAEL,
new LLCryptoLib.Crypto.TextAlgorithmParameters("password"));
string clearText = crypter.HexEncryptDecrypt(this.TextBox2.Text, false, LLCryptoLib.HexStyle.UNIX);
this.TextBox1.Text = clearText;
this.TextBox2.Text = "";
}
}
</script>