B4A Class [B4A/B4J] LockBox3 (Delphi) AES ECB/CBC encrypting / decrypting

Discussion in 'Additional libraries, classes and official updates' started by OliverA, Oct 5, 2018.

  1. OliverA

    OliverA Expert Licensed User

    This class can be used decrypt data created with LockBox3 and encrypt data that will be properly handled by LockBox3. LockBox3 is an encryption/decryption library for Delphi.

    There are actually three classes, LB3AES, LB3AESECB and LB3AESCBC. The only class that is used to instantiate an object is LB3AES. There are only 3 methods:
    1) Initialize(keySize As Int, password As String, mode As String)
    keySize is one of 128, 192, or 256.
    password is the password to be used for encrypting/decrypting.
    mode is the block chain mode used. Currently supports "ECB" and "CBC"
    2) DecryptString(cipherText As String) As String
    This method will decrypt a given cipher text produced by ToolBox3
    3) EncryptString(plainText As String) As String
    This method will encrypt a given plain text that will be understood by ToolBox3

    Please note: Both ToolBox3 and this class will have to use the same keySize, password, and mode for a given ciphertext/plaintext to be properly handled. Delphi must use UTF8 for all encodings (password and text to be encrypted/decrypted).

    For a write up on how I derived at this implementation, see https://www.b4x.com/android/forum/t...i-aes-encryption-exchange-with-b4a-b4j.97959/.

    2019/08/26: CBC Mode update:
    The CBC mode encryption/decryption did not work properly for plaintext/ciphertext messages that were longer than 16 bytes and whose length were not evenly divisible by 16. I'll update my write up for the solution to this issue.​

    As to the #MergedLibraries option, it looks like any JDK's based on OpenJDK (be it version 8 or 11) do not seem to have an issue with this option being set to True. The only JDK that seems to have issues with this is Oracle's implementation. See https://www.b4x.com/android/forum/threads/cannot-merge-external-library.109003

    2018/10/25: B4J Specific update:
    If you want greater than 128bit encryption:
    For JRE/JDK before 1.8.0_151, see https://stackoverflow.com/a/6481658
    For JRE/JDK starting with 1.8.0_151 and 9, see https://www.petefreitag.com/item/844.cfm
    For JRE/JDK after 9, you should be good to go.​
    Please note that this does depend on your region not being restricted from using strong cryptography.

    The Bouncy Castle .jar file that is required (as of this writing bcprov-jdk15on-160.jar, located here https://www.bouncycastle.org/latest_releases.html) is signed. In order for this library to work in Release mode (as it pertains to using these classes), the #MergeLibraries option must be set to False (see https://www.b4x.com/android/forum/threads/sshj-ssh-scp-sftp-for-java.88615/page-3#post-589290). This will have an implication on your application for distribution, since one needs to now include any library .jar files with the application. OpenJDK (at least version 11.0.1) does not seem to care how that option is set.

    The only change done to the previous upload is to set #MergeLibraries to False in the B4J project

    Thanks to @Diceman for bringing these issues to light.​
     

    Attached Files:

    Last edited: Aug 26, 2019
  2. Diceman

    Diceman Active Member Licensed User

    Great looking project. I am going to try it out later today. ;)

    Is there an advantage of using this class over jB4xEncryption or other encryption libraries? Is it more secure? Faster? Or is the primary advantage of this class is to share data with Delphi?

    TIA
     
  3. OliverA

    OliverA Expert Licensed User

    To share data with Delphi. B4XEncryption is just as hands off, since it handles salting and random IV for you. Plus it’s B4X. This one only works with B4J and B4A.
     
  4. Diceman

    Diceman Active Member Licensed User

    I am using B4J v6.51.

    I downloaded bouncy castle crypto-160.zip and copied the jar file bcprov-jdk15on-160.jar to my \B4j\AdditionalLibraries folder.
    When I compile your test.b4j app (in RELEASE MODE), when it tries to execute "c.initialize("AES/ECB/ISO7816-4PADDING") it throws an exception "NoSuchAlgorithmException" because it does not like the parameter. Maybe it has something to do with "4PADDING"?

    Code:
    'Initializes the object. You can add parameters to this method if needed.
    Public Sub Initialize(keyBytes() As Byte)
        c.Initialize(
    "AES/ECB/ISO7816-4PADDING")        '<--- NoSuchAlgorithmException (Release Mode)
        k.Initialize("AES")
        k.KeyFromBytes(keyBytes)
    End Sub
    Code:
    lb3aesecb._initialize (java line: 92)
    java.security.NoSuchAlgorithmException: Cannot find any provider supporting AES/ECB/ISO7816-4PADDING
        at javax.crypto.Cipher.getInstance(
    Cipher.java:540)
        at anywheresoftware.b4a.agraham.encryption.CipherWrapper.Initialize(CipherWrapper.java:
    127)
        at b4j.example.lb3aesecb._initialize(lb3aesecb.java:
    92)
        at b4j.example.lb3aes._initialize(lb3aes.java:
    117)
        at b4j.example.lb3aes_test._test(lb3aes_test.java:
    38)
        at b4j.example.main._appstart(main.java:
    49)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    90)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    77)
        at b4j.example.main.main(main.java:
    29)
    If I compile it for DEBUG mode it runs a little further but throws an exception when decrypting the text:

    Code:
    Public Sub DecryptString(cipherText As StringAs String
        
    Dim plainText As String = ""
       
        
    If cipherText <> Null Then
            
    If cipherText.Length > 0 Then
                
    Dim dataBytes() As Byte = su.DecodeBase64(cipherText)
                
    Dim decryptedBytes() As Byte = c.Decrypt(dataBytes, k.Key , False)                '<--- Exception: java.lang.reflect.InvocationTargetException
                plainText = BytesToString(decryptedBytes, 0, decryptedBytes.Length, "UTF8")
            
    End If
        
    End If
        
    Return plainText
    End Sub
    Code:
    Waiting for debugger to connect...
    Program started.
    The output should be: Decrypt this text test
    Error occurred on line: 
    33 (LB3AESECB)
    java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:
    460)
        at b4j.example.lb3aes._decryptstring(lb3aes.java:
    145)
        at b4j.example.lb3aes_test._test(lb3aes_test.java:
    46)
        at b4j.example.main._appstart(main.java:
    73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.shell.Shell.runMethod(
    Shell.java:628)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:234)
        at anywheresoftware.b4a.shell.Shell.raiseEvent(
    Shell.java:168)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    90)
        at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:
    98)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    77)
        at b4j.example.main.main(main.java:
    29)
    Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:
    131)
        at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:
    78)
        ... 
    23 more
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:
    112)
        ... 
    24 more
    Caused by: java.security.InvalidKeyException: Illegal key size 
    or default parameters
        at javax.crypto.Cipher.checkCryptoPerm(
    Cipher.java:1026)
        at javax.crypto.Cipher.implInit(
    Cipher.java:801)
        at javax.crypto.Cipher.chooseProvider(
    Cipher.java:864)
        at javax.crypto.Cipher.init(
    Cipher.java:1249)
        at javax.crypto.Cipher.init(
    Cipher.java:1186)
        at anywheresoftware.b4a.agraham.encryption.CipherWrapper.doFinal(CipherWrapper.java:
    139)
        at anywheresoftware.b4a.agraham.encryption.CipherWrapper.Decrypt(CipherWrapper.java:
    150)
        at b4j.example.lb3aesecb._decryptstring(lb3aesecb.java:
    63)
        ... 
    29 more
    Program terminated (StartMessageLoop was 
    not called).
    Do you have any idea what the problem could be? I am running your test app without any changes. I have confirmed B4J is referencing the new bcprov-jdk15on-160.jar file that I downloaded.

    TIA
     
  5. OliverA

    OliverA Expert Licensed User

    1) Facepalm. Looks like I never tested this in Release mode in B4J. I used B4J to develop this (i'm more comfortable with B4J) and then targeted B4A. Since I just used B4J for testing, I guess I never used Release mode.
    2) Looks like in Release mode this line
    Code:
    joSecurity.RunMethod("addProvider"Array As Object (jo))
    has no effect or I need to add a "pause" after doing this. So far I'm having no luck. I also do not want to add sleep/wait for, since that would change the whole usage of the library. Please note, on my System, in Debug mode, this works 100% under B4J 6.51. If you comment this line out, you'll get the same error message in Debug mode as you do in Release mode.
     
  6. OliverA

    OliverA Expert Licensed User

    For the first error (issue with Release mode):

    Try adding
    Code:
    #MergeLibraries: False
    The hint came from: https://www.b4x.com/android/forum/threads/sshj-ssh-scp-sftp-for-java.88615/page-3#post-589290
    Takeaway from that link: It looks like #MergeLibraries: True (the default, out of the box, setting for B4X) is "tampering" with Bouncy Castle's signed jar. It looks like the merging only happens in Release mode. If this works for you, I'll update my post.

    Note#1: This means that any additional libraries need to be now distributed with the application.
    Note#2: It looks like this may be an issue for any signed .jar that is used in an application.
    Note#3: Tested under JDK 8 and 10. Both needed to have MergeLibraries set to False before the B4J app would work in Release mode.
    Note#4: I really need to test more beforehand.

    As to the second error:

    I can reproduce that error when you change the string to be decrypted to something that is not decryptable (accidentally deleted an character or just try to decrypt a bunch of mumbo jumbo). I guess you would need to wrap DecryptString with a try catch block to catch these errors (of feeding an incorrect string into DecryptString). Download the example again, set merge libraries to false and re-run the example. It should work.
     
  7. Diceman

    Diceman Active Member Licensed User

    Setting MergeLibraries: False eliminates the first error.

    I am still getting different exceptions though in your test.b4j application.
    (I redownloaded your test app, but the code in it hasn't changed so I assume the only change made to it was for me to manually set Main to "#MergeLibraries: False" which I did.)

    Release Mode:
    Code:
    The output should be: Decrypt this text test
    lb3aes._decryptstring (java line: 
    51)
    java.lang.RuntimeException: java.security.InvalidKeyException: Illegal key size 
    or default parameters
        at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:
    496)
        at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:
    442)
        at b4j.example.lb3aes._decryptstring(lb3aes.java:
    51)
        at b4j.example.lb3aes_test._test(lb3aes_test.java:
    42)
        at b4j.example.main._appstart(main.java:
    49)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    90)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    77)
        at b4j.example.main.main(main.java:
    29)
    Caused by: java.security.InvalidKeyException: Illegal key size 
    or default parameters
        at javax.crypto.Cipher.checkCryptoPerm(
    Cipher.java:1026)
        at javax.crypto.Cipher.implInit(
    Cipher.java:801)
        at javax.crypto.Cipher.chooseProvider(
    Cipher.java:864)
        at javax.crypto.Cipher.init(
    Cipher.java:1249)
        at javax.crypto.Cipher.init(
    Cipher.java:1186)
        at anywheresoftware.b4a.agraham.encryption.CipherWrapper.doFinal(CipherWrapper.java:
    139)
        at anywheresoftware.b4a.agraham.encryption.CipherWrapper.Decrypt(CipherWrapper.java:
    150)
        at b4j.example.lb3aesecb._decryptstring(lb3aesecb.java:
    57)
        at b4j.example.lb3aesecb.callSub(lb3aesecb.java:
    103)
        at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:
    471)
        ... 
    11 more
    And I get a different exception in Debug mode:
    Code:
    Waiting for debugger to connect...
    Program started.
    The output should be: Decrypt this text test
    Error occurred on line: 
    33 (LB3AESECB)
    java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:
    460)
        at b4j.example.lb3aes._decryptstring(lb3aes.java:
    145)
        at b4j.example.lb3aes_test._test(lb3aes_test.java:
    46)
        at b4j.example.main._appstart(main.java:
    73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.shell.Shell.runMethod(
    Shell.java:628)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:234)
        at anywheresoftware.b4a.shell.Shell.raiseEvent(
    Shell.java:168)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    90)
        at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:
    98)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    77)
        at b4j.example.main.main(main.java:
    29)
    Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:
    131)
        at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:
    78)
        ... 
    23 more
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:
    112)
        ... 
    24 more
    Caused by: java.security.InvalidKeyException: Illegal key size 
    or default parameters
        at javax.crypto.Cipher.checkCryptoPerm(
    Cipher.java:1026)
        at javax.crypto.Cipher.implInit(
    Cipher.java:801)
        at javax.crypto.Cipher.chooseProvider(
    Cipher.java:864)
        at javax.crypto.Cipher.init(
    Cipher.java:1249)
        at javax.crypto.Cipher.init(
    Cipher.java:1186)
        at anywheresoftware.b4a.agraham.encryption.CipherWrapper.doFinal(CipherWrapper.java:
    139)
        at anywheresoftware.b4a.agraham.encryption.CipherWrapper.Decrypt(CipherWrapper.java:
    150)
        at b4j.example.lb3aesecb._decryptstring(lb3aesecb.java:
    63)
        ... 
    29 more
    Program terminated (StartMessageLoop was 
    not called).
    If your Test sub, you are decrypting text without first encrypting it. Granted you are passing the DecryptString with what looks like an encrypted string, but it might not be encrypted correctly. I don't know why you don't assign EncryptString to a variable and then pass that variable to DecryptString in the next statement. I played around with this and still got exceptions though. Not sure what the problem is. When you have time can you take a look at it (no rush)? I am using your test.b4j app with the only modified line is "#MergeLibraries: False" so I don't know why you're not seeing these exceptions.

    I downloaded B4J v6.51 yesterday. Are there any more libraries that I need to update?
    TIA

    Code:
    Public Sub Test
        
    Dim lb3_ecb As LB3AES
        lb3_ecb.Initialize(
    256"156xukn""ECB")
        
    Log("The output should be: Decrypt this text test")
        
    Log(lb3_ecb.DecryptString("SjGSQBY0xu2JG6sWDL3w+T+/rmY20Z93+vSWUGDRklU="))  '<--Decrypting first
        Log(lb3_ecb.EncryptString("Decrypt this text test"))    '<--Then encrypting?
        Dim lb3_cbc As LB3AES
        lb3_cbc.Initialize(
    256"123""CBC")
        
    Log("The output should be: 0123456789123456")
        
    Log(lb3_cbc.DecryptString("eNPG2rdR/PPSPp1D6FQP7x95mIafW4Ql"))
        
    Log("The output should be: 0123456789012345")
        
    Log(lb3_cbc.DecryptString("9cvoc5smn/OlFeOjpTifyKZsukaShl7s"))
        
    Log("The output should be: 012345678901234")
        
    Log(lb3_cbc.DecryptString("RJSBnX2HSdfBVOmB4aDVuAx67v/KKtE="))
        
    Log("The output should be: 0123456789")
        
    Log(lb3_cbc.DecryptString("LwcJW9Y1HyS4D22NP2ExBOmQ"))
        
    Log("The output should be: 12345")
        
    Log(lb3_cbc.DecryptString(lb3_cbc.EncryptString("12345")))
        
    Log("The output should be: 5")
        
    Log(lb3_cbc.DecryptString(lb3_cbc.EncryptString("5")))
        
    Log("The output should be: Hello my darling how are you today")
        
    Log(lb3_cbc.DecryptString(lb3_cbc.EncryptString("Hello my darling how are you today")))
        
    Log("Output should return an empty string (which does not even produce a log line)")
        
    Log(lb3_cbc.DecryptString(lb3_cbc.EncryptString("")))
        
    Log("Output should return an empty string (which does not even produce a log line)")
        
    Log(lb3_cbc.EncryptString(""))
    End Sub
     
  8. OliverA

    OliverA Expert Licensed User

    I think you need to enable 256bit encryption on Java. All you have to do is uncomment a line in a configuration file. Do a search online, I’m currently away from my computer.

    Update: here is a link. Make sure you modify all JREs. Note: for older java versions, you need to download files. For newer versions, this may already be enabled.

    https://www.petefreitag.com/item/844.cfm
     
    Last edited: Oct 23, 2018
    Diceman likes this.
  9. Diceman

    Diceman Active Member Licensed User

    I solved it. I was using jdk1.8.0_121 which was either too old or maybe because because it was 32 bit.
    I upgraded to jdk-11.0.1 (64 bit) and your program worked fine from the start. I noticed in this latest release (11.0.1) the java.security config file has "crypto.policy=unlimited" which wasn't the case in the prior versions.

    Thanks again for your help. :)
     
    OliverA likes this.
  10. OliverA

    OliverA Expert Licensed User

    Did you still have MergeLibraries set to False? Just checking so I know how to update my original post.
     
  11. Diceman

    Diceman Active Member Licensed User

    I noticed with this latest version of Java, I don't have to set "#MergeLibraries: False". I tried it just now and it works with it set to false or true.
    But with my old jdk1.8.0_121 I did have to set "#MergeLibraries: False" to solve the first problem.

    Maybe mention in the original post if the user has an exception problem for them to try switching to the latest Java JDK and use 64bit?
     
  12. OliverA

    OliverA Expert Licensed User

    Are you sure you not running the test in Debug mode? I have JDK 8, 10 and, now 11 (all Oracle versions) and for all I have to set MergeLibraries to False when using Release mode.
     
  13. OliverA

    OliverA Expert Licensed User

    As above, it looks like Oracle's "commercial"/closed source JDK's need the #MergedLibraries: False setting. I just downloaded the OpenJDK version 11.0.1 (http://jdk.java.net/11/) and it does not require the setting. So what does this mean? Does OpenJDK not worry about/enforce signed .jar files?
     
  14. Diceman

    Diceman Active Member Licensed User

    I retested just to confirm your findings. Your code works fine with the open source JDK (11.0.1) 64bit whether Release or Debug and with #MergeLibraries: False or True. Previously I was using jdk1.8.0_121 but 32 bit. Were the 32bit jars causing the problem with encryption?

    I also noticed the java.security file for the open source JDK (11.0.1) has "crypto.policy=unlimited" turned on by default. The Oracle version 8.0.121 had it turned off by default.
     
  15. OliverA

    OliverA Expert Licensed User

    No, since I have the same issues using Oracle's 64bit JDK's version 1.8.0_xxx, 10.0.1 and 11.0.1 when it comes to the #MergeLibraries issue. The only version that does not care how that is set is OpenJDK's 11.0.1. Please note that as of 9, there are no 32 bit JDK's/JRE's.
     
  16. Diceman

    Diceman Active Member Licensed User

  17. aaronk

    aaronk Well-Known Member Licensed User

    I am running the sample project from post 1 (made no changes to it), and when I run it, it comes up with an error as shown below..

    I did try to find the file bcprov-jdk15on-160.jar from that link, but could only find bcprov-jdk15on-162.jar

    I wonder if that is the issue?
    Running this in debug mode using B4J.

    Any ideas on what might be wrong ?


     
  18. OliverA

    OliverA Expert Licensed User

    https://www.bouncycastle.org/download/bcprov-jdk15on-160.jar

    Please note that the CBC code is not working properly when communicating with Lockbox3 on Delphi. Between B4J and B4A client everything works. I'm currently working on a solution to the issue (if there is a solution).
     
  19. aaronk

    aaronk Well-Known Member Licensed User

    I am trying to decrypt a string using AES-128 in ECB mode. String I am trying to decrypt is from a 3rd party (not something I encrypted).

    Will this work with this library/class ?
     
  20. OliverA

    OliverA Expert Licensed User

    This was designed to interoperate with Lockbox3, an encryption library for Delphi published by TurboPower. It uses a very specific padding, so if whatever software that creates the ECB encryption you try to decode does not use that padding, this will not work. The source is provided (first post) and can be adapted to the padding required. If you create a new post with your requirements, you may get some help. From me, it may be tomorrow (it's getting late here).
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice