I’ve been working on S2 support. Most of the crypto is supported in the JDK, but occasionally I have to use the bouncy castle (BC) lib. No problem, I see it’s already used elsewhere within OH. All is well when running OH with app.bndrun from eclipse, BC gets invoked correctly, I can run pairing tests and make progress.
But, while working in the zwave project in eclipse or maven, if I try to invoke any BC code directly (as in junit or a main method), I get the following error:
java.lang.SecurityException: Security Invalid signature file digest for Manifest main attributes
I understand the error message. The bouncy castle jar is a signed jar. The error means the jar was modified (or exploded) so the signature validation fails. The question is… why does it fail only in this scenario?
The same error occurs if I run mvn test
on the zwave project from the command line. My new test case CmacTest.test
fails with the error above, all other test cases pass.
I’m confident the jar in my local maven cache is valid as I can create a new maven project in the OH eclipse, add BC to the pom.xml, and invoke BC code just fine. This is how I’ve been doing BC development for now. I copy the code to the alternate project, write/debug/test, copy it back to the zwave project.
Any ideas on how to resolve this? It would certainly speed things up and I’d need to add test cases.
The failing test case is in my zwave fork on the s2-testcase branch at dbadia/org.openhab.binding.zwave at s2-testcase (github.com)
to reproduce just checkout that branch, run mvn test
and you should get
[ERROR] CmacTest.test:26 » Security Invalid signature file digest for Manifest main attributes
[ERROR] Tests run: 306, Failures: 0, Errors: 1, Skipped: 8
FWIW I’m using zulu17.32.13-ca-jdk17.0.2-win_x64 and apache-maven-3.9.5.
TIA!