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

Encrypting and decrypting from file to file (VB.NET example)

'Encryption example

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

      

encrypt.ProcessFile( "c:\test\file.txt", 0, 0, XceedEncryptionLib.EXEFileProcessing.efpEncrypt, true, "c:\test\file.enc", false, bytesRead )

 

Catch except As System.Runtime.InteropServices.COMException

MessageBox.Show( except.ToString() )

End Try

 

'Decryption example

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

 

      encrypt.ProcessFile( "c:\test\file.enc", 0, 0, XceedEncryptionLib.EXEFileProcessing.efpDecrypt, true, "c:\test\file2.txt", false, bytesRead )

 

Catch except As System.Runtime.InteropServices.COMException

MessageBox.Show( except.ToString() )

End Try