Hi Experts / Awesome people,
If someone could please help me.
I am looking for the equivalent code in B4A for this VB.Net code:
Thank you in advance for your time!
Regards,
Jacques.
If someone could please help me.
I am looking for the equivalent code in B4A for this VB.Net code:
B4X:
Public Function EncryptAES(ByVal stringToEncrypt As String, ByVal sEncryptionKey As String) As String
Dim EncryptionKey As String = sEncryptionKey
Dim clearBytes As Byte() = Encoding.ASCII.GetBytes(stringToEncrypt)
Using encryptor As Aes = Aes.Create()
Dim pdb As New Rfc2898DeriveBytes(EncryptionKey, New Byte() {211, 5, 233, 24, 55, 166, 7, 88, 2, 1, 4, 5, 6, 7, 8, 0})
encryptor.Key = pdb.GetBytes(32)
encryptor.IV = pdb.GetBytes(16)
Using ms As New MemoryStream()
Using cs As New CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write)
cs.Write(clearBytes, 0, clearBytes.Length)
cs.Close()
End Using
stringToEncrypt = Convert.ToBase64String(ms.ToArray())
End Using
End Using
Return stringToEncrypt
End Function
Thank you in advance for your time!
Regards,
Jacques.