dlt-interoperability / commitment-agent

1 stars 1 forks source link

Incompatible versions of the BC security provider between Fabric and web3j #4

Closed airvin closed 4 years ago

airvin commented 4 years ago

When both the Fabric java SDK and web3j core are listed as dependencies, the Fabric client throws an exception when trying to enroll a user:

Exception in thread "DefaultDispatcher-worker-1" java.lang.NoSuchFieldError: qTESLA_I
        at org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder.<clinit>(Unknown Source)
        at org.bouncycastle.operator.jcajce.JcaContentSignerBuilder.<init>(Unknown Source)
        at org.hyperledger.fabric.sdk.security.certgen.TLSCertificateBuilder.createSelfSignedCertificate(TLSCertificateBuilder.java:125)

It seems Fabric uses an old version of the Bouncy Castle security provider (bcprov-jdk15on v1.62), and web3j uses the latest version (1.65). Apparently it is not possible to upgrade Fabric to anything beyond v1.62. See this Jira issue for more details.

This stackoverflow question describes why these providers are incompatible.

VRamakrishna commented 4 years ago

@airvin Is it possible to use an older version of web3j that depends on BC 1.62?

Alternatively, how about writing two separate modules, one based on Fabric-SDK-Java and another based on web3j (I imagine this is for the bulletin board?) and have them communicate through HTTP?

airvin commented 4 years ago

Both good suggestions, thanks! I'll look into them

airvin commented 4 years ago

I ended up writing them as two separate modules and it fixes the issue. They now run as independent processes, which is probably a better way to do things anyway.