B4J Question Encrypting Bytes

cklester

Active Member
Licensed User
I'm running a test encryption and getting an error.

Here's the relevant function:

B4X:
Sub AppStart (Args() As String)
    Log("running testBytesEncryption")
    testBytesEncryption
End Sub

Private Sub testBytesEncryption
    Dim enc As B4XCipher
    Dim b() As Byte
    Dim s As String
    s = "sjdhflaksjdf lasdf8 shf8s7fh sjdhf aslkdjfh sdifah dlfi743h89r73h4r3$R#$T#G3ng78gh89a7dfh9a87s:"
    b = s.GetBytes("UTF8")
    Log("String is " & s & " (" & b.Length & "B)")
'    Log(enc.Decrypt(enc.Encrypt(b,LockboxEncryptionKey),LockboxEncryptionKey))
End Sub
I get an error in the log:

B4X:
running testBytesEncryption
main._testbytesencryption (java line: 134)
java.lang.NoClassDefFoundError: org/bouncycastle/crypto/Digest
    at b4j.example.main._testbytesencryption(main.java:134)
    at b4j.example.main._appstart(main.java:91)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.main(main.java:28)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.crypto.Digest
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 9 more
In the Libraries Manager, I have both Encryption and jB4XEncryption. Both are needed, so I hope there is no conflict there.

Why is it crashing? I haven't even started accessing enc yet.

What am I missing?

OK, is this B4XEncryption also needed?
 
Top