Xceed Encryption Library Documentation
Encrypting and decrypting entirely in memory (C# example)
Examples > Encrypting and decrypting entirely in memory (C# example)
C# - Encryption Copy Code

XceedEncryptionLib.XceedEncryption encrypt = new XceedEncryptionLib.XceedEncryptionClass(); 

encrypt.License( @"your license key" ); 

XceedEncryptionLib.XceedRijndaelEncryptionMethod rijndael = new XceedEncryptionLib.XceedRijndaelEncryptionMethodClass();            

object source = "This is the data to encrypt";

try
{
  rijndael.SetSecretKeyFromPassPhrase( "This is a weak pass phrase", 128 );
  encrypt.EncryptionMethod = rijndael;      

  object encryptedData = encrypt.Encrypt( ref source, true );
}
catch( System.Runtime.InteropServices.COMException except )
{
  MessageBox.Show( except.ToString() );
}

C# - Decryption Copy Code

XceedEncryptionLib.XceedEncryption encrypt = new XceedEncryptionLib.XceedEncryptionClass(); 

encrypt.License( @"your license key" ); 

XceedEncryptionLib.XceedRijndaelEncryptionMethod rijndael = new XceedEncryptionLib.XceedRijndaelEncryptionMethodClass();            

try
{
  rijndael.SetSecretKeyFromPassPhrase( "This is a weak pass phrase", 128 );
  encrypt.EncryptionMethod = rijndael;      

  object decryptedData = encrypt.Decrypt( ref encryptedData, true );

  MessageBox.Show( System.Text.Encoding.Unicode.GetString( ( byte[] )decryptedData ) );
}
catch( System.Runtime.InteropServices.COMException except )
{
  MessageBox.Show( except.ToString() );
}