Log(CryptedString)
Dim tmpByte() As Byte
Dim newString As String
tmpByte=funzioni.AesEncrypt(CryptedString,Main.EnryptPassword,1)
newString =bc.HexFromBytes(tmpByte)
Sub AesEncrypt(Text As String ,chiave As String, Mode As Int) As Byte() 'mode= 0/1 = encode/decode
Dim key() As Byte
Dim data() As Byte
Dim bytes() As Byte
key = ByteConv.HexToBytes(chiave)
Dim Kg As KeyGenerator
Dim c As Cipher
c.Initialize("AES/ECB/NoPadding") ' just "DES" actually performs "DES/ECB/PKCS5Padding".
Kg.Initialize("AES")
Kg.KeyFromBytes(key)
If Mode = 0 Then
data =ByteConv.HexToBytes(Text)
data = c.Encrypt(data, Kg.key, False)
Return data
Else If Mode = 1 Then
data = ByteConv.HexToBytes(Text)
bytes = c.Decrypt(data, Kg.key,False)
Main.DeCryptedString=ByteConv.HexFromBytes(bytes)
Return bytes
End If
End Sub