B4A Library SecureMyText - AES256PasswordBasedEncryption-Decryption

This is a wrap for this Github project. Author of this project is rishelarora

I just wrote the wrapper to be able to use the Githubproject in B4A.

AES256PasswordBasedEncryption-Decryption A library that lets you use the AES 256 password based encryption/decryption for your android application in the easiest manner.

SecureMyText
Author:
Github rishelarora - DonManfred (wrapper)
Version: 1
  • SecureMyText
    Methods:
    • EncryptToFinalTransferText (str As String) As String
    • Initialize (EventName As String, password As String)
    • IsInitialized As Boolean
    • decrypt (str As String) As String
    • encrypt (str As String) As String
    Properties:
    • IterationCount As Int [write only]
 

Attachments

  • SecureMyText.zip
    3.6 KB · Views: 747
Last edited:

davidt

Member
Licensed User
Longtime User
Nice work on this library Don, but I am getting an error when I attempt to add to my project.
I can confirm that the android-support-v4.jar resides in the c:\Program Files (x86)\Anywhere Software\Basic4Android\Libraries directory.

Am I missing something else?

upload_2016-7-18_15-0-14.png
 

davidt

Member
Licensed User
Longtime User
Thanks. Installing now. I had selected Android Support Library instead of Android Support Repository.

upload_2016-7-18_15-40-6.png
 

Reids

Member
Licensed User
Longtime User
I got error while decrypting the text, encrypt work well but the decrypting is not working:
B4X:
** Activity (main) Create, isFirst = true **
Error occurred on line: 85 (Main)
java.lang.StringIndexOutOfBoundsException: length=25; regionStart=0; regionLength=-13
    at java.lang.String.startEndAndLength(String.java:583)
    at java.lang.String.substring(String.java:1464)
    at rage.aes.secureencryptanddecrypt.SecureMyText.decrypt(SecureMyText.java:114)
    at de.donmanfred.SecureMyTextWrapper.decrypt(SecureMyTextWrapper.java:85)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)



My Code :
B4X:
   secure.Initialize("secure","testing")
   Dim wew As String=secure.encrypt("TESTING")
   ToastMessageShow(wew,True)
   Dim buset As String=secure.decrypt(wew)
   ToastMessageShow(buset,True)


More question, the encrypted string didn't have fixed value? it always changed on every encrypt process
 

DonManfred

Expert
Licensed User
Longtime User
I got error while decrypting the text, encrypt work well but the decrypting is not working:
have you tried to use EncryptToFinalTransferText to encrypt? The decrypt method seems to be based on this output as you can see in github project...
 
Top