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

Here are is an example for VB that demonstrates encryption from memory to file 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 vaSource As Variant 

Set xEnc. EncryptionMethod = New XceedRijndaelEncryptionMethod

vaSource = "This is the data to encrypt" 

On Error Resume Next

Call xEnc. EncryptionMethod.SetSecretKeyFromPassPhrase("This is a weak pass phrase!", 128)
Call xEnc.WriteFile(vaSource, efpEncrypt, True, "c:\temp\encrypted.aes", False) 

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

On Error Goto 0

Set xEnc = Nothing