BouncyCastle dependencies

593 views
Skip to first unread message

Bitcoin Enthusiast

unread,
Apr 3, 2012, 12:01:28 AM4/3/12
to bitc...@googlegroups.com
What are the proper BouncyCastle source dependencies? I'm not using Maven. The latest sources from bouncycastle.org do not seem to be compatible:

./com/google/bitcoin/core/ECKey.java:106: error: no suitable constructor found for DERSequenceGenerator(ASN1OutputStream)
           
DERSequenceGenerator seq = new DERSequenceGenerator(encoder);

./com/google/bitcoin/core/ECKey.java:109: error: cannot find symbol
            seq
.addObject(new DERTaggedObject(0, SECNamedCurves.getByName("secp256k1").getDERObject()));
                                                                                     
^
  symbol
:   method getDERObject()
  location
: class X9ECParameters

This is BitcoinJ 0.4. Tried with both lcrypto-jdk15on-147 and bcprov-jdk15on-147. Attempted to compile with both jdk1.6 and jdk1.7.

I fully expect that I've simply missed something obvious. Any assistance appreciated.


Miron Cuperman

unread,
Apr 3, 2012, 1:25:00 AM4/3/12
to bitc...@googlegroups.com
Maven says bcprov-jdk15-1.46.jar

Mike Hearn

unread,
Apr 3, 2012, 4:27:03 AM4/3/12
to bitc...@googlegroups.com
If that doesn't work let us know.

Is there a reason you're not using Maven? The library has quite a few dependencies these days, the automatic resolution is quite helpful.
--

Mike Hearn | Senior Software Engineer |  he...@google.com |  Account security team

Jonny Heggheim

unread,
Apr 3, 2012, 5:56:55 AM4/3/12
to bitc...@googlegroups.com
There are two easy ways to get the dependencies:
 * Run `mvn dependency:copy-dependencies` in the bitcoinj(-core) folder, this will copy all needed jars into target/dependency
 * Use build systems like Ant via Ivy, Gradle, Maven and Buildr that all supports Maven repositories.


Jonny

Jim

unread,
Apr 3, 2012, 6:21:17 AM4/3/12
to bitc...@googlegroups.com
@Bitcoin Enthusiast

If you are using ant, then I would recommend converting to Maven.
The MultiBit build was originally ant and (with help) I converted it
to Maven and would never move back.

You can always drop down to ant inside Maven if you have to.
(Puts on tinfoil hat in preparation for flamewar from Maven purists).

:-)

--
http://multibit.org Money, reinvented

Bitcoin Enthusiast

unread,
Apr 3, 2012, 10:05:27 AM4/3/12
to bitc...@googlegroups.com
Thanks for your quick feedback, all. As I expected, the short answer is "use Maven," which is fine. I just like to get my hands dirty, especially when I first start into a new codebase, to get the feel for it. Double-especially with security-sensitive software, in case the developers have done their own tinkering on the dependencies themselves that I should be aware of (I'm not accusing here, just for example, it can happen with a less conscientious team). In short, my disposition is just to do everything the hard way.

In this case, the latest bouncycastle (v1.47) API was not backward compatible with your project's proper dependency (v1.46). Their Porting Guide points out precisely the DER/ASN1 changes from 1.46 that caused my troubles.

Sorry to have taken your time on this, but I appreciate your helpfulness, and look forward to further bitcoinj development.

Mike Hearn

unread,
Apr 3, 2012, 11:25:21 AM4/3/12
to bitc...@googlegroups.com
In this case, the latest bouncycastle (v1.47) API was not backward compatible with your project's proper dependency (v1.46). Their Porting Guide points out precisely the DER/ASN1 changes from 1.46 that caused my troubles.

Sorry to have taken your time on this, but I appreciate your helpfulness, and look forward to further bitcoinj development.

No problem and thanks for letting us know about the backwards incompatible changes.

We should update to the latest BC at some point. I filed a bug.

Bitcoin Enthusiast

unread,
Apr 3, 2012, 11:41:04 AM4/3/12
to bitc...@googlegroups.com
Glad to be of assistance. (I wish I could mark this topic as Resolved, or close/lock it, or even just edit the title, but I guess that's not the convention here.)

David Lancashire

unread,
May 29, 2014, 1:09:16 AM5/29/14
to bitc...@googlegroups.com

I ran into the same issue. The following worked for me as of May 29, 2014:

- android-support-v4.jar
- bitcoinj-0.11.2.jar
- guava-17.0.jar
- sc-light-jdk15on-1.47.0.2.jar
- slf4j-android-1.7.7.jar
- alf4j-api-1.7.7.jar

Not everyone starts with Maven, so posting this in case it is useful for other developers
Reply all
Reply to author
Forward
0 new messages