diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..e07cefd805 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +language: java +jdk: + - oraclejdk8 + +install: + - git clone -b bisq_0.14.4.1 https://github.com/bitsquare/bitcoinj.git + - cd bitcoinj + - mvn clean install + - git clone https://github.com/bitsquare/libdohj.git + - cd libdohj + - mvn clean install + - git clone https://github.com/bitsquare/btcd-cli4j.git + - cd btcd-cli4j + - mvn clean install + - cd .. + +script: mvn clean install + +#notifications: +# irc: +# channels: chat.freenode.net#bisq +# template: +# - '%{message} (%{repository}#%{build_number}, %{duration})' +# - '%{repository}/%{branch} %{commit} %{author}: %{commit_message}' +# - '%{build_url}' +# on_success: change +# on_failure: always +# use_notice: true +# skip_join: true \ No newline at end of file diff --git a/_deactivated_.travis.yml b/_deactivated_.travis.yml deleted file mode 100644 index 0d82b3d0e5..0000000000 --- a/_deactivated_.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: java -jdk: oraclejdk8 - -install: - - "sudo apt-get purge openjdk*" - - "sudo add-apt-repository -y ppa:webupd8team/java" - - "sudo apt-get update" - - "sudo apt-get install oracle-java8-installer" - -notifications: - irc: - channels: chat.freenode.net#bisq - template: - - '%{message} (%{repository}#%{build_number}, %{duration})' - - '%{repository}/%{branch} %{commit} %{author}: %{commit_message}' - - '%{build_url}' - on_success: change - on_failure: always - use_notice: true - skip_join: true \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index b69bdf5f02..6b51396928 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -11,18 +11,90 @@ common + + 3.3.0 + + + + + windows + + + windows + + + + windows-x86_64 + protoc.exe + + + + unix + + + unix + + + + linux-x86_64 + protoc + + + + macos + + + macos + + + + osx-x86_64 + protoc + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.0.1 + + + copy-protoc + generate-sources + + copy + + + + + com.google.protobuf + protoc + ${protobuf.version} + ${protobuf.classifier} + exe + true + ${project.build.directory} + ${protobuf.exe} + + + + + + org.xolstice.maven.plugins protobuf-maven-plugin 0.5.0 - /usr/local/bin/protoc + ${project.build.directory}/${protobuf.exe} + generate-sources compile test-compile @@ -37,7 +109,7 @@ com.google.protobuf protobuf-java - 3.3.0 + ${protobuf.version} com.google.code.gson diff --git a/core/pom.xml b/core/pom.xml index 07ff001ea9..71f13c7b90 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -15,12 +15,12 @@ io.bisq common - ${project.parent.version} + ${project.version} io.bisq network - ${project.parent.version} + ${project.version} diff --git a/core/src/main/java/io/bisq/core/arbitration/ArbitratorManager.java b/core/src/main/java/io/bisq/core/arbitration/ArbitratorManager.java index d059dd858a..6a8325d0de 100644 --- a/core/src/main/java/io/bisq/core/arbitration/ArbitratorManager.java +++ b/core/src/main/java/io/bisq/core/arbitration/ArbitratorManager.java @@ -91,7 +91,7 @@ public class ArbitratorManager { private final User user; private final Preferences preferences; private final ObservableMap arbitratorsObservableMap = FXCollections.observableHashMap(); - private final List persistedAcceptedArbitrators; + private List persistedAcceptedArbitrators; private Timer republishArbitratorTimer, retryRepublishArbitratorTimer; @@ -105,13 +105,19 @@ public class ArbitratorManager { this.arbitratorService = arbitratorService; this.user = user; this.preferences = preferences; + } - persistedAcceptedArbitrators = new ArrayList<>(user.getAcceptedArbitrators()); - user.clearAcceptedArbitrators(); + public void shutDown() { + stopRepublishArbitratorTimer(); + stopRetryRepublishArbitratorTimer(); + } - // TODO we mirror arbitrator data for mediator as long we have not impl. it in the UI - user.clearAcceptedMediators(); + /////////////////////////////////////////////////////////////////////////////////////////// + // API + /////////////////////////////////////////////////////////////////////////////////////////// + + public void onAllServicesInitialized() { arbitratorService.addHashSetChangedListener(new HashMapChangedListener() { @Override public void onAdded(ProtectedStorageEntry data) { @@ -129,19 +135,13 @@ public class ArbitratorManager { } } }); - } - public void shutDown() { - stopRepublishArbitratorTimer(); - stopRetryRepublishArbitratorTimer(); - } + persistedAcceptedArbitrators = new ArrayList<>(user.getAcceptedArbitrators()); + user.clearAcceptedArbitrators(); + // TODO we mirror arbitrator data for mediator as long we have not impl. it in the UI + user.clearAcceptedMediators(); - /////////////////////////////////////////////////////////////////////////////////////////// - // API - /////////////////////////////////////////////////////////////////////////////////////////// - - public void onAllServicesInitialized() { if (user.getRegisteredArbitrator() != null) { P2PService p2PService = arbitratorService.getP2PService(); if (p2PService.isBootstrapped()) diff --git a/doc/build.md b/doc/build.md index 8446e96e6d..ca0dabdcfa 100644 --- a/doc/build.md +++ b/doc/build.md @@ -74,8 +74,8 @@ For Mac OSX, you will need to set JAVA_HOME as: $ . ~/.bashrc -### 2. Install the latest protobuffer release on your machine (3.3.0 at the time of writing): -https://github.com/google/protobuf/releases +### Protobuf +Note that Bisq use protobuf during maven build https://github.com/google/protobuf/releases ### 2.1 Increase the Intellij Idea Code insight limit, because it breaks on the generated protobuffer files: Go to Help > Edit custom properties => paste the following line: @@ -108,58 +108,16 @@ It is not needed for a normal user to run such a "full node" but for the build i $ cd btcd-cli4j $ mvn clean install -DskipTests -Dmaven.javadoc.skip=true - -Prepare bisq build ------------------ -### 4. Install Protobuffer - -Install Protobuffer. - - $ wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip - $ unzip protoc-3.3.0-linux-x86_64.zip -d protoc3 - $ sudo mv protoc3/bin/protoc /usr/local/bin/protoc - -### 5. Get bisq source code and build a preliminary bisq version (don't run the jar, it wont work) - -We need to get the bisq dependencies resolved first as we need to copy the BouncyCastle jar to the JRE directory. - - $ git clone https://github.com/bitsquare/bitsquare.git - $ cd bisq - $ mvn clean package -DskipTests -Dmaven.javadoc.skip=true - -### 6. Copy the BouncyCastle provider jar file - -Copy the BountyCastle provider jar file from the local maven repository to the jre/lib/ext directory. -This prevents a "JCE cannot authenticate the provider BC" exception when starting the bisq client. - - $ sudo cp ~/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.53/bcprov-jdk15on-1.53.jar $JAVA_HOME/jre/lib/ext/ - -### 7. Edit the java.security file and add BouncyCastleProvider - -Add org.bouncycastle.jce.provider.BouncyCastleProvider as last entry at: List of providers and their preference orders -E.g.: -security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider - - $ sudo gedit $JAVA_HOME/jre/lib/security/java.security - ... edit and save - -### 8. Enable unlimited Strength for cryptographic keys (only required for Oracle JDK) - -If you are using Oracle JDK 8 you must **[enable strong cryptographic cyphers](https://github.com/jonathancross/jc-docs/blob/master/java-strong-crypto-test/README.md)**. If you use OpenJDK + OpenJFX you can skip this step. - -In Windows the new crypto files need to be copied to `Java/jdk1.8.0_xxx/jre/lib/security` AND `Java/jre1.8.0_xxx/jre/lib/security` otherwise the test in the above page will fail. - - Build bisq ----------------- -### 9. Build final bisq jar +### 1. Build final bisq jar Now we have all prepared to build the correct bisq jar. $ mvn clean package verify -DskipTests -Dmaven.javadoc.skip=true -When the build completes, you will find an executable jar: `gui/target/shaded.jar`. +When the build completes, you will find an executable jar: `gui/target/shaded.jar` and a ./lib directory. To run it use: $ java -jar gui/target/shaded.jar @@ -167,7 +125,7 @@ To run it use: Build binaries ----------------- -If you want to build the binaries check out the build scripts under the package directory. +If you want to build the binaries check out the build scripts under the package directory. copy shaded.jar and the lib directory. DAO full node diff --git a/gui/pom.xml b/gui/pom.xml index af6168a0d8..199062bd42 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -49,19 +49,62 @@ + + + org.apache.maven.plugins + maven-dependency-plugin + 3.0.1 + + + copy-bouncycastle + package + + copy + + + true + + + org.bouncycastle + bcprov-jdk15on + true + ${project.build.directory}/lib + + + org.bouncycastle + bcpg-jdk15on + true + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins maven-shade-plugin 2.3 + + + org.bouncycastle:*:*:* + + false - - io.bisq.gui.app.BisqAppMain + + + io.bisq.gui.app.BisqAppMain + + lib/bcpg-jdk15on.jar lib/bcprov-jdk15on.jar + + true @@ -233,7 +276,7 @@ org.bitcoinj:orchid:1.1.1:jar:null:compile:7898329eae76ec6bfdf27081234bb222d5be09df - org.bouncycastle:bcprov-jdk15on:1.53:jar:null:compile:9d3def2fa5a0d2ed0c1146e9945df10d29eb4ccb + org.bouncycastle:bcprov-jdk15on:1.56:jar:null:compile:a153c6f9744a3e9dd6feab5e210e1c9861362ec7 org.controlsfx:controlsfx:8.0.6_20:jar:null:compile:5a4ca2765419fe12af0f0c7c5a8129c53bb661d9 @@ -296,7 +339,7 @@ io.bisq core - ${project.parent.version} + ${project.version} diff --git a/gui/src/main/java/io/bisq/gui/app/BisqAppMain.java b/gui/src/main/java/io/bisq/gui/app/BisqAppMain.java index db75cf3436..ab7ae6276e 100644 --- a/gui/src/main/java/io/bisq/gui/app/BisqAppMain.java +++ b/gui/src/main/java/io/bisq/gui/app/BisqAppMain.java @@ -24,17 +24,26 @@ import joptsimple.OptionException; import joptsimple.OptionParser; import joptsimple.OptionSet; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.security.Permission; +import java.security.PermissionCollection; import java.util.Locale; +import java.util.Map; import static io.bisq.core.app.BisqEnvironment.DEFAULT_APP_NAME; import static io.bisq.core.app.BisqEnvironment.DEFAULT_USER_DATA_DIR; public class BisqAppMain extends BisqExecutable { + static { + removeCryptographyRestrictions(); + } + public static void main(String[] args) throws Exception { // Need to set default locale initially otherwise we get problems with non-english systems Locale.setDefault(Locale.ENGLISH); - + // We don't want to do the full argument parsing here as that might easily change in update versions // So we only handle the absolute minimum which is APP_NAME, APP_DATA_DIR_KEY and USER_DATA_DIR OptionParser parser = new OptionParser(); @@ -71,4 +80,55 @@ public class BisqAppMain extends BisqExecutable { BisqApp.setEnvironment(getBisqEnvironment(options)); javafx.application.Application.launch(BisqApp.class); } + + private static void removeCryptographyRestrictions() { + if (!isRestrictedCryptography()) { + System.out.println("Cryptography restrictions removal not needed"); + return; + } + try { + /* + * Do the following, but with reflection to bypass access checks: + * + * JceSecurity.isRestricted = false; + * JceSecurity.defaultPolicy.perms.clear(); + * JceSecurity.defaultPolicy.add(CryptoAllPermission.INSTANCE); + */ + final Class jceSecurity = Class.forName("javax.crypto.JceSecurity"); + final Class cryptoPermissions = Class.forName("javax.crypto.CryptoPermissions"); + final Class cryptoAllPermission = Class.forName("javax.crypto.CryptoAllPermission"); + + final Field isRestrictedField = jceSecurity.getDeclaredField("isRestricted"); + isRestrictedField.setAccessible(true); + final Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(isRestrictedField, isRestrictedField.getModifiers() & ~Modifier.FINAL); + isRestrictedField.set(null, false); + + final Field defaultPolicyField = jceSecurity.getDeclaredField("defaultPolicy"); + defaultPolicyField.setAccessible(true); + final PermissionCollection defaultPolicy = (PermissionCollection) defaultPolicyField.get(null); + + final Field perms = cryptoPermissions.getDeclaredField("perms"); + perms.setAccessible(true); + ((Map) perms.get(defaultPolicy)).clear(); + + final Field instance = cryptoAllPermission.getDeclaredField("INSTANCE"); + instance.setAccessible(true); + defaultPolicy.add((Permission) instance.get(null)); + + System.out.println("Successfully removed cryptography restrictions"); + } catch (final Exception e) { + System.err.println("Failed to remove cryptography restrictions" + e); + } + } + + private static boolean isRestrictedCryptography() { + // This matches Oracle Java 7 and 8, but not Java 9 or OpenJDK. + final String name = System.getProperty("java.runtime.name"); + final String ver = System.getProperty("java.version"); + return name != null && name.equals("Java(TM) SE Runtime Environment") + && ver != null && (ver.startsWith("1.7") || ver.startsWith("1.8")); + } + } diff --git a/jtorproxy/pom.xml b/jtorproxy/pom.xml index d1c90b1366..a33afe5cbe 100644 --- a/jtorproxy/pom.xml +++ b/jtorproxy/pom.xml @@ -15,12 +15,12 @@ io.bisq jsocks - ${project.parent.version} + ${project.version} io.bisq jtorctl - ${project.parent.version} + ${project.version} diff --git a/network/pom.xml b/network/pom.xml index bb47e91549..98dc186a4c 100644 --- a/network/pom.xml +++ b/network/pom.xml @@ -15,12 +15,12 @@ io.bisq common - ${project.parent.version} + ${project.version} io.bisq jtorproxy - ${project.parent.version} + ${project.version} diff --git a/network/src/test/java/io/bisq/network/p2p/storage/P2PDataStorageTest.java b/network/src/test/java/io/bisq/network/p2p/storage/P2PDataStorageTest.java index e9f97355a8..b73171ee8d 100644 --- a/network/src/test/java/io/bisq/network/p2p/storage/P2PDataStorageTest.java +++ b/network/src/test/java/io/bisq/network/p2p/storage/P2PDataStorageTest.java @@ -18,6 +18,7 @@ import mockit.integration.junit4.JMockit; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.runner.RunWith; import java.io.File; @@ -31,6 +32,8 @@ import java.util.Set; @Slf4j @RunWith(JMockit.class) +// TODO +@Ignore("CoreProtobufferResolver is not accessible here: We should refactor it so that the classes themselves know how to deserialize so we don't get dependencies from core objects here") public class P2PDataStorageTest { private final Set seedNodes = new HashSet<>(); private EncryptionService encryptionService1, encryptionService2; @@ -84,10 +87,6 @@ public class P2PDataStorageTest { FileUtil.deleteDirectory(dir2); } - //TODO CoreProtobufferResolver is not accessible here -// We should refactor it so that the classes themselves know how to deserialize -// so we don't get dependencies from core objects here - /* @Test public void testProtectedStorageEntryAddAndRemove() throws InterruptedException, NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, CryptoException, SignatureException, InvalidKeyException, NoSuchProviderException { storagePayload = new AlertPayload(new AlertVO("alert", diff --git a/pom.xml b/pom.xml index a3f4a188fc..acb18638bf 100644 --- a/pom.xml +++ b/pom.xml @@ -131,19 +131,16 @@ org.bouncycastle bcprov-jdk15on - 1.56 org.bouncycastle bcpg-jdk15on - 1.56 org.bouncycastle bcpg-jdk16 - 1.46 @@ -250,4 +247,39 @@ test + + + + + enable-strong-cipher-jdk9 + + [1.9,) + + + unlimited + + + + + + + + + org.bouncycastle + bcprov-jdk15on + 1.56 + + + org.bouncycastle + bcpg-jdk15on + 1.56 + + + org.bouncycastle + bcpg-jdk16 + 1.46 + + + + diff --git a/provider/pom.xml b/provider/pom.xml index 7a8e59646d..d3af5e2abb 100644 --- a/provider/pom.xml +++ b/provider/pom.xml @@ -79,7 +79,7 @@ io.bisq core - ${project.parent.version} + ${project.version} diff --git a/seednode/pom.xml b/seednode/pom.xml index 3a71fd7ac2..5929e023c7 100644 --- a/seednode/pom.xml +++ b/seednode/pom.xml @@ -79,7 +79,7 @@ io.bisq core - ${project.parent.version} + ${project.version} \ No newline at end of file diff --git a/statistics/pom.xml b/statistics/pom.xml index 2bac454ee9..f9aeb60c87 100644 --- a/statistics/pom.xml +++ b/statistics/pom.xml @@ -78,7 +78,7 @@ io.bisq core - ${project.parent.version} + ${project.version} \ No newline at end of file