diff --git a/briar-core/.classpath b/briar-core/.classpath index 9e7ecd15eeea0aa7f338b0c5e5208858da88c5b6..7a5ed364f80e2d349287df67fc9dcd52cb575af9 100644 --- a/briar-core/.classpath +++ b/briar-core/.classpath @@ -3,10 +3,10 @@ <classpathentry kind="src" path="src"/> <classpathentry combineaccessrules="false" kind="src" path="/briar-api"/> <classpathentry kind="lib" path="/briar-api/libs/guice-3.0-no_aop.jar"/> - <classpathentry kind="lib" path="libs/sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar" sourcepath="libs/source/sc-light-jdk15on-1.47.0.3-SNAPSHOT-source.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="lib" path="/briar-api/libs/javax.inject.jar"/> <classpathentry kind="lib" path="libs/h2small-1.3.170.jar"/> <classpathentry kind="lib" path="libs/weupnp-0.1.3-SNAPSHOT-briar.jar"/> + <classpathentry kind="lib" path="libs/lcrypto-jdk15on-150.jar" sourcepath="libs/source/lcrypto-jdk15on-150-source.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/briar-core/libs/lcrypto-jdk15on-150.jar b/briar-core/libs/lcrypto-jdk15on-150.jar new file mode 100644 index 0000000000000000000000000000000000000000..75d3917bb4919e153c56bf591cc5426da601b340 Binary files /dev/null and b/briar-core/libs/lcrypto-jdk15on-150.jar differ diff --git a/briar-core/libs/sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar b/briar-core/libs/sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar deleted file mode 100644 index 628b56b6b1f06594d8e16f255d357e19cbb3b5f5..0000000000000000000000000000000000000000 Binary files a/briar-core/libs/sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar and /dev/null differ diff --git a/briar-core/libs/source/lcrypto-jdk15on-150-source.jar b/briar-core/libs/source/lcrypto-jdk15on-150-source.jar new file mode 100644 index 0000000000000000000000000000000000000000..b007552c1488678f1b5a001731863dac1aacb102 Binary files /dev/null and b/briar-core/libs/source/lcrypto-jdk15on-150-source.jar differ diff --git a/briar-core/libs/source/sc-light-jdk15on-1.47.0.3-SNAPSHOT-source.jar b/briar-core/libs/source/sc-light-jdk15on-1.47.0.3-SNAPSHOT-source.jar deleted file mode 100644 index 5e609448d26a66e1369e72fbef92a925321b2a8f..0000000000000000000000000000000000000000 Binary files a/briar-core/libs/source/sc-light-jdk15on-1.47.0.3-SNAPSHOT-source.jar and /dev/null differ diff --git a/briar-core/src/org/briarproject/crypto/EllipticCurveConstants.java b/briar-core/src/org/briarproject/crypto/EllipticCurveConstants.java index 79d24b904f9520a60733b98393ce80d95c0a8453..97e94aed3faecb386dda48dc6c5912b1da89c7b5 100644 --- a/briar-core/src/org/briarproject/crypto/EllipticCurveConstants.java +++ b/briar-core/src/org/briarproject/crypto/EllipticCurveConstants.java @@ -4,7 +4,6 @@ import java.math.BigInteger; import org.spongycastle.crypto.params.ECDomainParameters; import org.spongycastle.math.ec.ECCurve; -import org.spongycastle.math.ec.ECFieldElement; import org.spongycastle.math.ec.ECPoint; /** Parameters for curve brainpoolP384r1 - see RFC 5639. */ @@ -63,8 +62,6 @@ interface EllipticCurveConstants { // Static parameter objects derived from the above parameters ECCurve CURVE = new ECCurve.Fp(P, A, B); - ECPoint G = new ECPoint.Fp(CURVE, - new ECFieldElement.Fp(P, X), - new ECFieldElement.Fp(P, Y)); + ECPoint G = CURVE.createPoint(X, Y); ECDomainParameters PARAMETERS = new ECDomainParameters(CURVE, G, Q, H); } diff --git a/briar-core/src/org/briarproject/crypto/Sec1KeyParser.java b/briar-core/src/org/briarproject/crypto/Sec1KeyParser.java index b9077ffb5d60802ca9511c9d7d8ff09f1bc151da..e64de28aaa0e9aafdfd78c2495c14897f60f3c03 100644 --- a/briar-core/src/org/briarproject/crypto/Sec1KeyParser.java +++ b/briar-core/src/org/briarproject/crypto/Sec1KeyParser.java @@ -6,11 +6,9 @@ import java.security.GeneralSecurityException; import org.briarproject.api.crypto.KeyParser; import org.briarproject.api.crypto.PrivateKey; import org.briarproject.api.crypto.PublicKey; - import org.spongycastle.crypto.params.ECDomainParameters; import org.spongycastle.crypto.params.ECPrivateKeyParameters; import org.spongycastle.crypto.params.ECPublicKeyParameters; -import org.spongycastle.math.ec.ECFieldElement; import org.spongycastle.math.ec.ECPoint; /** @@ -58,9 +56,7 @@ class Sec1KeyParser implements KeyParser { BigInteger rhs = x.multiply(x).add(a).multiply(x).add(b).mod(modulus); if(!lhs.equals(rhs)) throw new GeneralSecurityException(); // We know the point (x, y) is on the curve, so we can create the point - ECFieldElement elementX = new ECFieldElement.Fp(modulus, x); - ECFieldElement elementY = new ECFieldElement.Fp(modulus, y); - ECPoint pub = new ECPoint.Fp(params.getCurve(), elementX, elementY); + ECPoint pub = params.getCurve().createPoint(x, y); // Verify that the point (x, y) is not the point at infinity if(pub.isInfinity()) throw new GeneralSecurityException(); // Verify that the point (x, y) times n is the point at infinity diff --git a/briar-core/src/org/briarproject/crypto/Sec1PublicKey.java b/briar-core/src/org/briarproject/crypto/Sec1PublicKey.java index eefdfde74b01714fb056af6fb5ddbbdac707da91..290f35ce19bf1a85d2877ddaa4c10b2f89dfde86 100644 --- a/briar-core/src/org/briarproject/crypto/Sec1PublicKey.java +++ b/briar-core/src/org/briarproject/crypto/Sec1PublicKey.java @@ -23,9 +23,9 @@ class Sec1PublicKey implements PublicKey { public byte[] getEncoded() { byte[] encodedKey = new byte[publicKeyBytes]; encodedKey[0] = 4; - byte[] x = key.getQ().getX().toBigInteger().toByteArray(); + byte[] x = key.getQ().getAffineXCoord().toBigInteger().toByteArray(); Sec1Utils.convertToFixedLength(x, encodedKey, 1, bytesPerInt); - byte[] y = key.getQ().getY().toBigInteger().toByteArray(); + byte[] y = key.getQ().getAffineYCoord().toBigInteger().toByteArray(); Sec1Utils.convertToFixedLength(y, encodedKey, 1 + bytesPerInt, bytesPerInt); return encodedKey; diff --git a/briar-tests/.classpath b/briar-tests/.classpath index 4d9d92d61c046fc519c4260e804a197afb1d495e..c93e2a667b180392ca1f8e51f85ccf931cfb3dc1 100644 --- a/briar-tests/.classpath +++ b/briar-tests/.classpath @@ -12,6 +12,6 @@ <classpathentry kind="lib" path="libs/jmock-2.5.1.jar"/> <classpathentry kind="lib" path="libs/junit-4.9b3.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="lib" path="/briar-core/libs/sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar" sourcepath="/briar-core/libs/source/sc-light-jdk15on-1.47.0.3-SNAPSHOT-source.jar"/> + <classpathentry kind="lib" path="/briar-core/libs/lcrypto-jdk15on-150.jar" sourcepath="/briar-core/libs/source/lcrypto-jdk15on-150-source.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/spongy.sh b/spongy.sh new file mode 100755 index 0000000000000000000000000000000000000000..a0d4043353110cecedbfde23156520195da44a0d --- /dev/null +++ b/spongy.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +dirs=(ant core docs jce mail pg pkix prov) + +for file in `find ${dirs[@]} -name bouncycastle` +do + path=`dirname $file` + echo "Moving $file to $path/spongycastle" + mv $file $path/spongycastle +done + +for file in `grep -Rl bouncycastle ${dirs[@]}` +do + echo "Replacing string bouncycastle in $file" + sed -i 's/bouncycastle/spongycastle/g' $file +done +