Xceed Encryption Library Documentation
Examples / Encrypting and decrypting entirely in memory (VB example)
In This Topic
    Encrypting and decrypting entirely in memory (VB example)
    In This Topic

    Here are is an example for VB that demonstrates encryption entirely in 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 vaSource As Variant
    Dim vaDest 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)

    vaDest = xEnc.Encrypt(vaSource, True) 

    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