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

Here are is an example for VB that demonstrates encryption from file to memory in a single pass. It shows how to use the Rijndael algorithm.

Visual Basic Copy Code

Dim xEnc As New XceedEncryption

Call xEnc.License( "your license key" )

Dim vaBytesRead As Variant 

Set xEnc. EncryptionMethod = New XceedRijndaelEncryptionMethod 

On Error Resume Next

Call xEnc. EncryptionMethod.SetSecretKeyFromPassPhrase("This is a weak pass phrase!", 128)
Call xEnc.ReadFile("c:\temp\source.txt", 0, 0, efpEncrypt, True, vaBytesRead) 

If Err.Number <> 0 Then
  Call MsgBox("Error 0x" & Hex(Err.Number) & " " & Err.Description) 
Else
  Call MsgBox("Encryption successful!") 
End If 

On Error Goto 0

Set xEnc = Nothing