Sub Encrypt(dataToEncrypt As String ) As String
Dim kg As KeyGenerator
Dim c As Cipher
Dim B64 As Base64
Dim bconv As ByteConverter
Dim data(0) As Byte
Dim iv(0) As Byte
iv = Array As Byte(211, 5, 233, 24, 55, 166, 7, 88)
c.Initialize("DESEDE/CBC/PKCS5Padding")
c.InitialisationVector = iv
kg.Initialize("DESEDE")
kg.KeyFromBytes(bconv.StringToBytes("5244067896183996","ASCII"))
data = bconv.StringToBytes(dataToEncrypt, "ASCII")
data = c.Encrypt(data, kg.Key, True)
Return B64.EncodeBtoS(data, 0, data.Length)
End Sub
Sub Decrypt(encryptedData As String ) As String
Dim kg As KeyGenerator
Dim c As Cipher
Dim B64 As Base64
Dim bconv As ByteConverter
Dim data(0) As Byte
Dim iv(0) As Byte
iv = Array As Byte(211, 5, 233, 24, 55, 166, 7, 88)
c.Initialize("DESEDE/CBC/PKCS5Padding")
c.InitialisationVector = iv
kg.Initialize("DESEDE")
kg.KeyFromBytes(bconv.StringToBytes("5244067896183996","ASCII"))
data = B64.DecodeStoB(encryptedData)
data = c.Decrypt(data, kg.Key, True)
Return bconv.StringFromBytes(data, "ASCII")
End Sub