Encryption encryption = new Encryption(); //Trial Mode
//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
MemoryStream input = new MemoryStream();
for (int i = 0; i < 255; i++)
input.WriteByte((byte)i);
input.Seek(0, SeekOrigin.Begin);
MemoryStream encryptedStream = new MemoryStream();
encryption.EncryptStream(EncryptionProvider.Rijndael, "My Password", input, encryptedStream, false);
encryptedStream.Seek(0, SeekOrigin.Begin);
MemoryStream decryptedStream = new MemoryStream();
encryption.DecryptStream(EncryptionProvider.Rijndael, "My Password", encryptedStream, decryptedStream, false);
decryptedStream.Seek(0, SeekOrigin.Begin);
input.Seek(0, SeekOrigin.Begin);
bool decryptedSucessfully = true;
for (int i = 0; i < input.Length; i++)
{
byte inputByte = (byte)input.ReadByte();
byte decryptedByte = (byte)decryptedStream.ReadByte();
if (inputByte != decryptedByte)
{
decryptedSucessfully = false;
break;
}
}
Console.WriteLine("Decrypted successfully: {0}", decryptedSucessfully);