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 = encryption.EncryptMemoryStream(EncryptionProvider.Rijndael, "My Password", input);
encryptedStream.Seek(0, SeekOrigin.Begin);
MemoryStream decryptedStream = encryption.DecryptMemoryStream(EncryptionProvider.Rijndael, "My Password", encryptedStream);
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);