Xceed Encryption Library Documentation
Encrypting and decrypting from file to memory (VB.NET example)
Examples > Encrypting and decrypting from file to memory (VB.NET example)
VB.NET - Encryption Copy Code

Dim encrypt As New XceedEncryptionLib.XceedEncryptionClass() 

encrypt.License( "your license key" ) 

Dim rijndael As New XceedEncryptionLib.XceedRijndaelEncryptionMethodClass() 

Try
  rijndael.SetSecretKeyFromPassPhrase( "This is a weak pass phrase", 128 )

  encrypt.EncryptionMethod = rijndael      

  Dim bytesRead As Object = Nothing 
  Dim encryptedData As Object = encrypt.ReadFile( "c:\test\file.txt", 0, 0, _
                                                  XceedEncryptionLib.EXEFileProcessing.efpEncrypt, _
                                                  true, bytesRead ) 

Catch except As System.Runtime.InteropServices.COMException
  MessageBox.Show( except.ToString() )
End Try

VB.NET - Decryption Copy Code

Dim encrypt As New XceedEncryptionLib.XceedEncryptionClass() 

encrypt.License( "your license key" ) 

Dim rijndael As New XceedEncryptionLib.XceedRijndaelEncryptionMethodClass() 

Try
  rijndael.SetSecretKeyFromPassPhrase( "This is a weak pass phrase", 128 )

  encrypt.EncryptionMethod = rijndael      

  encrypt.WriteFile( ref encryptedData, XceedEncryptionLib.EXEFileProcessing.efpDecrypt, _
                     true, "c:\test\file.txt", false ) 

Catch except As System.Runtime.InteropServices.COMException
  MessageBox.Show( except.ToString() )
End Try