Closed cipriansofronia closed 1 week ago
awesome. thank you. will have a look!
can you tell me what you mean with
it is quite difficult to work with the current default package layout
how so? what does that mean? i'm not a java guy, so understanding this helps me to not mess this up in the future.
Thank you, @stef, for picking it up so fast 🙏🏻! While setting up the JNI implementation, we noticed that Opaque.java
had to be placed in our project under src/main/java
. If we were to place it in a different package directory (smth like src/main/java/io/opaque
), System.loadLibrary
would not be able to properly bind the native implementation at runtime. However, we encountered another issue: we could not import the Opaque classes because java cannot load classes from the default package when there is a package hierarchy. Therefore, by specifying the package path in jni.c
, we were able to import the Opaque classes properly wherever needed. Hope this makes sense!
ok. makes sense. one last question why io? is there other options like "auth" or "crypto"? or can i choose my own? like "ctrlc"? i have zero clue about these things, so excuse my naiveté.
it can be whatever you think is better.. so, should I rename it to ctrlc
? any other ideas? it would just be a package location for .java files
ah, good to know. thanks for the answer. i dunno, io doesn't tell me anything, ctrlc is what i would use if i had to use an org. would you?
btw you might want to pull/merge https://github.com/stef/libopaque/commit/a34fc5f207db86adabefc3d7da1f53f9fdb64eb9 which should fix the CI/CD tests. i've been working hard on liboprf (a dependency of libopaque) and thus there is a bit of fixing to be done for the codeql tests...
sure, I can go with ctrlc
, io
is commonly used in java/scala world for projects, but we can set it up as u suggested
so, should I go with ctrlc
or smth like ctrlc/opaque
?
$ make clean test
rm -rf build
rm -f opaque.jar
rm -f libopaquejni.so
javac -d build test.java ctrlc/Opaque.java ctrlc/OpaqueCredReq.java ctrlc/OpaqueCredResp.java ctrlc/OpaqueCreds.java ctrlc/OpaqueIds.java ctrlc/OpaquePreRecExpKey.java ctrlc/OpaqueRecExpKey.java ctrlc/OpaqueRegReq.java ctrlc/OpaqueRegResp.java
jar -cvfe opaque.jar Main build
added manifest
adding: build/(in = 0) (out= 0)(stored 0%)
adding: build/ctrlc/(in = 0) (out= 0)(stored 0%)
adding: build/ctrlc/OpaqueCreds.class(in = 257) (out= 208)(deflated 19%)
adding: build/ctrlc/OpaqueRecExpKey.class(in = 250) (out= 203)(deflated 18%)
adding: build/ctrlc/OpaquePreRecExpKey.class(in = 256) (out= 206)(deflated 19%)
adding: build/ctrlc/OpaqueCredResp.class(in = 254) (out= 201)(deflated 20%)
adding: build/ctrlc/Opaque.class(in = 1985) (out= 757)(deflated 61%)
adding: build/ctrlc/OpaqueCredReq.class(in = 239) (out= 188)(deflated 21%)
adding: build/ctrlc/OpaqueRegReq.class(in = 235) (out= 185)(deflated 21%)
adding: build/ctrlc/OpaqueIds.class(in = 326) (out= 247)(deflated 24%)
adding: build/ctrlc/OpaqueRegResp.class(in = 239) (out= 188)(deflated 21%)
adding: build/Main.class(in = 4732) (out= 2472)(deflated 47%)
gcc jni.c -shared -fPIC -o libopaquejni.so -I/opt/java/openjdk/include -I/opt/java/openjdk/include/linux -lopaque
java -enableassertions -Djava.library.path=. -classpath build:opaque.jar Main
rec=[B@4e0e2f2a, ek=[B@73d16e93
sec=[B@2a139a55, pub=[B@15db9742
sec=[B@7852e922, pub=[B@4e25154f
rec=[B@5c647e05, ek=[B@33909752
sec=[B@55f96302, pub=[B@3d4eac69
sec=[B@42a57993, pub=[B@75b84c92
rec: 2d914c0d6339a791f9dfdf5bb58d065bac6b8c9fb1cbdbd0d8bf8e9b735a1f052abaf3b0cb7554f23756de405cd72f85d834c98425328c4db6cd4a24531b1f3bc870ccc084c954e6c31a07bf32e175c29a5b622409fa0e96f365f550043dff15d3e405ff09d0ac829a982dec5f05953f7c5cc1a535684f6b43b0ac82be99c8e26240cedd6af05f86a53161cf219b0b4bd4d918b33561c449949907d43e8a8a201321743072f6d4c52c5280f143eb67a5e01ab6b78521b7a4eae028296f77c673713aee79e40235d1de41c6999d7ae7757f1af0932aabe1428942795b441496db719ce1f65d4eff52a1ea2e0efbf86672f0e705a1f30859ad585cbfe88237e760
sec=[B@677327b6, pub=[B@14ae5a5
sec=[B@7f31245a, pub=[B@6d6f6e28
rec: cd1a190ec8e0fe20583c175eed0fd8d0ca0e5f6f2a1ce366362f05f0aeb5d907000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1fd82ae6e9ed34099ab306734abb26402bf445efed12fe250e712f68200e8aee6fcc1497c44954248d189ad025349913e37b2fa818be700c22f4f6f49f1fa42b482be02d58a3fbe6522e08de262496518ac1a081d31a049bf0235f4a288c9c818cdac0065b8874ca1702944361476e42bf93d50c847b0b91eff8b7f168c98f73c1382c08fbe4fd37b4202cab1df8ff1e527a4486fdb577345531d3a009880839e699b78e68fc646baebaefb6ca15dfa35d9909777c66657e555f2bf9b09b29a591
sec=[B@135fbaa4, pub=[B@45ee12a7
sec=[B@330bedb4, pub=[B@2503dbd3
everything ok
sure, I can go with ctrlc, io is commonly used in java/scala world for projects
if that is the custom, then sure let's keep it that way.
ah fuck, i just saw you already renamed, it. i'll handle it from here. thx. will be merged today.
no worries, u can merge it with ctrlc
package name as well, no problem
much <3 and thanks for putting up with my ignorance!
btw if you are able to disclose where and how you're using libopaque, it would be very interesting to know.
I can only share the name of the company where this will be used, which is InvestSuite 😄
may I ask you to release a new tag with these changes, please? thank you 🙏🏻
While working with the java jni implementation we discovered that it is quite difficult to work with the current default package layout, so this PR aims to introduce a small change that will allow projects to easily import Opaque dependencies.