VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



VB.NET Examples

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

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Byte Array
VB.NET FTPS
System.IO

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

AES symmetric encryption as defined by NIST

Example program to encrypt byte data using 128-bit AES CBC encryption.

' Create an instance of the Chilkat encryption class.
        Dim crypt As New Chilkat.Crypt2()

        ' Any code begins the 30-day trial.
        crypt.UnlockComponent("30-day-trial")

        ' Encrypt with...
        ' AES symmetric encryption as defined by NIST. 
        ' 128 bit keys. 
        ' Cipher block chaining mode (CBC). 
        ' 128 bit initialization vector prefixing the ciphertext. 
        ' Padding according to RFC 2630

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

        ' Set the password.
        crypt.SecretKey = crypt.GenerateSecretKey("myPassword")

        Dim iv(16) As Byte
        ' Set the IV to any value desired...
        crypt.IV = iv

        ' RFC 2630 uses this padding scheme, which is identical to RFC 1423
        ' (for AES, k = 16)
        '        Some content-encryption algorithms assume the input length is a
        '        multiple of k octets, where k is greater than one.  For such
        '        algorithms, the input shall be padded at the trailing end with
        '        k-(lth mod k) octets all having value k-(lth mod k), where lth is
        '        the length of the input.  In other words, the input is padded at
        '        the trailing end with one of the following strings:
        '
        '                            01 -- if lth mod k = k-1
        '                        02 02 -- if lth mod k = k-2
        '                            .
        '                            .
        '                            .
        '                    k k ... k k -- if lth mod k = 0
        '
        '        The padding can be removed unambiguously since all input is padded,
        '        including input values that are already a multiple of the block size,
        '        and no padding string is a suffix of another.  This padding method is
        '        well defined if and only if k is less than 256.
        crypt.PaddingScheme = 0

        ' Encrypt some data...
        Dim inputByteData(1000) As Byte
        ' ....
        Dim encryptedBytes() As Byte
        encryptedBytes = crypt.EncryptBytes(inputByteData)


Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 

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

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

Mail Component · XML Parser