Public Sub SetAES1(Mess As String, Key As String, HaveToEncrypt As Boolean) As String
Dim AesString As String
Dim c As B4XCipher
Dim b() As Byte
Dim su As StringUtils
Try
If HaveToEncrypt = True Then
b = c.Encrypt(Mess.GetBytes("utf8"), Key)
AesString = su.EncodeBase64(b)
Log(AesString)
Else
Dim enc() As Byte = su.DecodeBase64(Mess)
b = c.Decrypt(enc, Key)
AesString = BytesToString(b, 0, b.Length, "utf8")
End If
Catch
' ShowLog("Error getting Password or Key", True, LastException.Message)
AesString = "Wrong-Key"
End Try
Return AesString
End Sub