Sub Button1_Click
peticion
End Sub
Sub Button2_Click
Dim iv(0) As Byte
iv = Array As Byte(11, 22, 33, 44, 55, 66, 77, 88,11, 22, 33, 44, 55, 66, 77, 88) ' 16
cc = EncryptText("CC", iv) 'llamo la función para encryptar y envio el vector IV en este caso estatico
End Sub
Sub EncryptText(text As String, iv() As Byte) As Byte()
Dim data() As Byte
Dim key() As Byte
Dim kg As KeyGenerator
Dim c As Cipher
c.Initialize("AES/CBC/PKCS7Padding") ' replace "DES/" with "AES/" for Rijndael or "DESEDE/" for triple DES
c.InitialisationVector = iv
kg.Initialize("AES")
data = text.GetBytes("ASCII") 'ASCII
key = Bconv.StringToBytes("Aqui su clave de encrypcion xxx", "ASCII")
kg.KeyFromBytes(key)
data = c.Encrypt(data, kg.key, True)
Log(B64.EncodeBtoS(data,0,data.Length))
Return B64.EncodeBtoS(data,0,data.Length)
End Sub