B4A Library [B4X] B4XEncryption

Not open for further replies.
This library allows you to encrypt or decrypt data using the AES encryption method.

It is simple to use and it is compatible with B4J jB4XEncryption library and B4i Encryption library (Encrypt and Decrypt method) which means that you can encrypt the data on one platform and decrypt it on a different platform.

Usage example:
Sub EncryptText(text As String, password As String) As Byte()
   Dim c As B4XCipher
   Return c.Encrypt(text.GetBytes("utf8"), password)
End Sub

Sub DecryptText(EncryptedData() As Byte, password As String) As String
   Dim c As B4XCipher
   Dim b() As Byte = c.Decrypt(EncryptedData, password)
   Return BytesToString(b, 0, b.Length, "utf8")
End Sub

Dim encryptedData() As Byte = EncryptText("confidential", "123456")
Log(DecryptText(encryptedData, "123456"))

B4XPages example project is attached.


  • Project.zip
    14 KB · Views: 589
Last edited:

Chris Lee

Licensed User
Not open for further replies.