From 7f892506ca66a28c9df1474ce61abfb54841568a Mon Sep 17 00:00:00 2001 From: FabHuy17 Date: Mon, 14 Nov 2016 16:07:36 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Modifications=20pour=20java8=20et=20bibliot?= =?UTF-8?q?h=C3=A8ques=20=C3=A0=20jour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 62 +++++++++++-------- src/main/java/com/geoxp/oss/CryptoHelper.java | 3 +- .../oss/client/OSSSshAgentAddIdentity.java | 5 +- 3 files changed, 41 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index e252c0a..2536646 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'jetty' apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' -sourceCompatibility = 1.6 +sourceCompatibility = 1.8 configurations { tools @@ -38,27 +38,37 @@ import org.ajoberstar.gradle.git.tasks.*; task clonejuds(type: GitClone) { def destination = file('juds') - uri = 'https://github.com/mcfunley/juds.git' + //uri = 'https://github.com/mcfunley/juds.git' + uri = 'https://github.com/CreditMutuelArkea/juds.git' destinationPath = destination bare = false enabled = !destination.exists() //to clone only once } -task confjuds(type: Exec, dependsOn: 'clonejuds') { +task autoconfjuds(type: Exec, dependsOn: 'clonejuds') { workingDir './juds' - if (!new File('./juds/juds-0.94.jar').exists()) { - commandLine './configure','CFLAGS=-I' + System.getProperty('java.home') + '/include' + if (!new File('./juds/juds-0.95.jar').exists()) { + commandLine './autoconf.sh' } else { - commandLine 'ls', 'juds-0.94.jar' + commandLine 'ls', 'juds-0.95.jar' } } -task buildjuds(type: Exec, dependsOn: 'confjuds') { +task configurejuds(type: Exec, dependsOn: 'autoconfjuds') { workingDir './juds' - if (!new File('./juds/juds-0.94.jar').exists()) { + if (!new File('./juds/juds-0.95.jar').exists()) { + commandLine './configure','CFLAGS=-I' + '/opt/java8/include' + } else { + commandLine 'ls', 'juds-0.95.jar' + } +} + +task buildjuds(type: Exec, dependsOn: 'configurejuds') { + workingDir './juds' + if (!new File('./juds/juds-0.95.jar').exists()) { commandLine 'make' } else { - commandLine 'ls', 'juds-0.94.jar' + commandLine 'ls', 'juds-0.95.jar' } } @@ -75,23 +85,23 @@ repositories { // dependencies { - compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.47' - compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.47' - compile group: 'org.bouncycastle', name: 'bcpg-jdk15on', version: '1.47' - compile group: 'javax.servlet', name: 'servlet-api', version: '2.5' - compile group: 'com.google.inject', name: 'guice', version: '3.0' - compile group: 'com.google.inject.extensions', name: 'guice-servlet', version: '3.0' - compile group: 'com.google.code.gson', name: 'gson', version: '2.2.2' - compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.2.5' - compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.2.5' - compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.6' - compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.6' - compile group: 'org.apache.pig', name: 'pig', version: '0.8.0', transitive: false - compile group: 'org.apache.zookeeper', name: 'zookeeper', version: '3.3.5', transitive: false - compile group: 'org.apache.hadoop', name: 'hadoop-core', version: '0.20.2', transitive: false - compile group: 'log4j', name: 'log4j', version: '1.2.15', transitive: false + compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.55' + compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.55' + compile group: 'org.bouncycastle', name: 'bcpg-jdk15on', version: '1.55' + compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0' + compile group: 'com.google.inject', name: 'guice', version: '4.1.0' + compile group: 'com.google.inject.extensions', name: 'guice-servlet', version: '4.1.0' + compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0' + //compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.5' + compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2' + compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21' + //compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.21' + compile group: 'org.apache.pig', name: 'pig', version: '0.16.0', transitive: false + compile group: 'org.apache.zookeeper', name: 'zookeeper', version: '3.4.8', transitive: false + compile group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.2.1', transitive: false + //compile group: 'log4j', name: 'log4j', version: '1.2.17', transitive: false - compile files('juds/juds-0.94.jar') + compile files('juds/juds-0.95.jar') tools files('tools/jarjar-1.4.jar') @@ -102,7 +112,7 @@ war { ext.clspth = [] for (f in classpath) { - if (!f.toString().endsWith('juds-0.94.jar')) { + if (!f.toString().endsWith('juds-0.95.jar')) { ext.clspth.add(f) } } diff --git a/src/main/java/com/geoxp/oss/CryptoHelper.java b/src/main/java/com/geoxp/oss/CryptoHelper.java index 40bf809..825d1fc 100644 --- a/src/main/java/com/geoxp/oss/CryptoHelper.java +++ b/src/main/java/com/geoxp/oss/CryptoHelper.java @@ -76,6 +76,7 @@ import org.bouncycastle.openpgp.PGPUtil; import org.bouncycastle.openpgp.operator.bc.BcPGPDataEncryptorBuilder; import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator; +import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator; import org.bouncycastle.util.encoders.Hex; import com.etsy.net.JUDS; @@ -2690,7 +2691,7 @@ public static byte[] SSSSRecover(Collection secrets) { // public static List PGPPublicKeysFromKeyRing(String keyring) throws IOException { - PGPObjectFactory factory = new PGPObjectFactory(PGPUtil.getDecoderStream(new ByteArrayInputStream(keyring.getBytes("UTF-8")))); + PGPObjectFactory factory = new PGPObjectFactory(PGPUtil.getDecoderStream(new ByteArrayInputStream(keyring.getBytes("UTF-8"))), new BcKeyFingerprintCalculator()); List pubkeys = new ArrayList(); diff --git a/src/main/java/com/geoxp/oss/client/OSSSshAgentAddIdentity.java b/src/main/java/com/geoxp/oss/client/OSSSshAgentAddIdentity.java index e5f2e69..678d287 100644 --- a/src/main/java/com/geoxp/oss/client/OSSSshAgentAddIdentity.java +++ b/src/main/java/com/geoxp/oss/client/OSSSshAgentAddIdentity.java @@ -10,7 +10,7 @@ import java.util.List; import org.bouncycastle.util.encoders.Hex; import org.bouncycastle.openssl.EncryptionException; -import org.bouncycastle.openssl.PEMReader; +import org.bouncycastle.openssl.PEMParser; import org.bouncycastle.openssl.PasswordFinder; import com.geoxp.oss.CryptoHelper; @@ -79,7 +79,8 @@ public static void main(String[] args) throws Exception { for (File sshKeyFile : sshKeyFiles) { Reader fRd = new BufferedReader(new FileReader(sshKeyFile)); - PEMReader pem = new PEMReader(fRd, new DefaultPasswordFinder(password.toCharArray()), "BC"); + //PEMReader pem = new PEMReader(fRd, new DefaultPasswordFinder(password.toCharArray()), "BC"); + PEMParser pem = new PEMParser(fRd); Object o; try { From 90d57b54545b16a5765137affbc19b63387992f4 Mon Sep 17 00:00:00 2001 From: FabHuy17 Date: Tue, 15 Nov 2016 09:07:07 +0100 Subject: [PATCH 2/3] Correction de source-compatibility --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2536646..93bc06f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'jetty' apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' -sourceCompatibility = 1.8 +sourceCompatibility = 1.6 configurations { tools From a51291b9af707fb1b7c15604dc01f2002477e808 Mon Sep 17 00:00:00 2001 From: FabHuy17 Date: Mon, 24 Apr 2017 09:30:11 +0200 Subject: [PATCH 3/3] =?UTF-8?q?MAJ=20d=C3=A9pendance=20BouncyCastle=20Corr?= =?UTF-8?q?ection=20initilisation=20cl=C3=A9s=20dans=20CryptoHelper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 +++--- src/main/java/com/geoxp/oss/CryptoHelper.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 93bc06f..25aa213 100644 --- a/build.gradle +++ b/build.gradle @@ -85,9 +85,9 @@ repositories { // dependencies { - compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.55' - compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.55' - compile group: 'org.bouncycastle', name: 'bcpg-jdk15on', version: '1.55' + compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.56' + compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.56' + compile group: 'org.bouncycastle', name: 'bcpg-jdk15on', version: '1.56' compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0' compile group: 'com.google.inject', name: 'guice', version: '4.1.0' compile group: 'com.google.inject.extensions', name: 'guice-servlet', version: '4.1.0' diff --git a/src/main/java/com/geoxp/oss/CryptoHelper.java b/src/main/java/com/geoxp/oss/CryptoHelper.java index 825d1fc..b8d2904 100644 --- a/src/main/java/com/geoxp/oss/CryptoHelper.java +++ b/src/main/java/com/geoxp/oss/CryptoHelper.java @@ -342,7 +342,7 @@ public static byte[] encryptRSA(Key key, byte[] data) { if (key instanceof RSAPublicKey) { c.init(true, new RSAKeyParameters(true, ((RSAPublicKey) key).getModulus(), ((RSAPublicKey) key).getPublicExponent())); } else if (key instanceof RSAPrivateKey) { - c.init(true, new RSAKeyParameters(true, ((RSAPrivateKey) key).getModulus(), ((RSAPrivateKey) key).getPrivateExponent())); + c.init(true, new RSAKeyParameters(false, ((RSAPrivateKey) key).getModulus(), ((RSAPrivateKey) key).getPrivateExponent())); } else { return null; }