i have an old jetty based app, i recently updated b4j to latest release 9.80 and I get this error: (java.security.InvalidKeyException: Wrong key size) when the app is launched from the build folder created with create package standalone, while the problem does not exist if run in debug mode in B4J.
the app uses the encryption 1.10 library
and #AdditionalJar: bcprov-jdk15on-154
I manually copied the bcprov-jdk15on-154.jar file to the bin, lib and root folders of the app but the problem persists
I attach error log:
Caused by: java.security.InvalidKeyException: Wrong key size
at java.base/com.sun.crypto.provider.DESedeCrypt.init(Unknown Source)
at java.base/com.sun.crypto.provider.CipherBlockChaining.init(Unknown Source)
at java.base/com.sun.crypto.provider.CipherCore.init(Unknown Source)
at java.base/com.sun.crypto.provider.DESedeCipher.engineInit(Unknown Source)
at java.base/javax.crypto.Cipher.implInit(Unknown Source)
at java.base/javax.crypto.Cipher.chooseProvider(Unknown Source)
at java.base/javax.crypto.Cipher.init(Unknown Source)
at java.base/javax.crypto.Cipher.init(Unknown Source)
at b4j/anywheresoftware.b4a.agraham.encryption.CipherWrapper.doFinal(Unknown Source)
at b4j/anywheresoftware.b4a.agraham.encryption.CipherWrapper.Decrypt(Unknown Source)
at b4j/b4j.example.webservice1._decrypt(Unknown Source)
at b4j/b4j.example.webservice1._handle(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
If you are using the latest B4J, you will be using the latest jServer. That version needs JDK 11 and above. You may need to update your bouncy castle libs for JDK 11 and above
If you are using the latest B4J, you will be using the latest jServer. That version needs JDK 11 and above. You may need to update your bouncy castle libs for JDK 11 and above
I updated the library #AdditionalJar: bcprov-jdk15on-165
Jetty is up to date as it is now a b4j standard library and is jserver 4-01
The problem remains the same! Everything works fine in the B4J ide but not in the distributed package, tested on the same PC
Thank you for your time and patience,
I tried the provider #AdditionalJar: bcprov-ext-jdk18on-172.jar but the problem persists.
What I can't understand why if started inside B4j everything works correctly?
I have a test which runs great on my development MacBook Pro, but fails to run in continuous integration TeamCity server. The error is following: java.security.InvalidKeyException: Illegal key si...
Attached is a b4x program to review.
Are two equal programs one in b4a and one in b4j that encrypt and decrypt a string.
The b4a programwork in release mode. The b4j program if started from the B4J IDE works correctly, but the packaged standalone version when I press the CLICK key reports the error: java.security.NoSuchAlgorithmException: No such algorithm: DESEDE/CBC/PKCS5Padding
I tried manually copying the bcprov-ext-jdk18on-172.jar file into the lIb folder of the build folder but the problem persists.
How to get a working exe to distribute?
The problem was solved by the XorAndOr user, the main solution was to use a 24-bit password instead of 16. Furthermore, this routine was modified by commenting the lines:
codice modificato:
Sub InitializeCipher(c As Cipher, transformation As String)
c.Initialize(transformation)
' Dim r As Reflector
' Dim o As Object = r.RunStaticMethod("javax.crypto.Cipher", "getInstance", Array(transformation, "BC"), _
' Array As String("java.lang.String", "java.lang.String"))
' r.Target = c
' r.SetField2("cipher", o)
End Sub