Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
AES symmetric encryption as defined by NISTDownload: Chilkat .NET Assemblies 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 |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.