diff --git a/build.gradle b/build.gradle index e252c0a..25aa213 100644 --- a/build.gradle +++ b/build.gradle @@ -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.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' + 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..b8d2904 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; @@ -341,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; } @@ -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 {