Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor


VB Strings
VB Byte Array

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

AES String Encryption

Download Chilkat Crypt ActiveX

AES string encryption in Visual Basic.

Dim crypt As New ChilkatCrypt2

Dim success As Long
success = crypt.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    MsgBox "Crypt component unlock failed"
    Exit Sub
End If

Dim password As String
password = "secretPassPhrase"

crypt.CryptAlgorithm = "aes"
crypt.CipherMode = "cbc"
crypt.KeyLength = 128

' Generate a binary secret key from a password string
' of any length.  For 128-bit encryption, GenEncodedSecretKey
' generates the MD5 hash of the password and returns it
' in the encoded form requested.  The 2nd param can be
' "hex", "base64", "url", "quoted-printable", etc.
Dim hexKey As String
hexKey = crypt.GenEncodedSecretKey(password,"hex")
crypt.SetEncodedKey hexKey,"hex"

crypt.EncodingMode = "base64"
Dim text As String
text = "The quick brown fox jumped over the lazy dog."

' Encrypt a string and return the binary encrypted data
' in a base-64 encoded string.
Dim encText As String
encText = crypt.EncryptStringENC(text)

Text1.Text = Text1.Text & encText & vbCrLf
Text1.Refresh

' Decrypt and show the original string:
Dim decryptedText As String
decryptedText = crypt.DecryptStringENC(encText)

Text1.Text = Text1.Text & decryptedText & vbCrLf
Text1.Refresh

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.