Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java8 #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 35 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand All @@ -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')

Expand All @@ -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)
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/geoxp/oss/CryptoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -2690,7 +2691,7 @@ public static byte[] SSSSRecover(Collection<byte[]> secrets) {
//

public static List<PGPPublicKey> 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<PGPPublicKey> pubkeys = new ArrayList<PGPPublicKey>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down