mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
335 lines
19 KiB
Diff
335 lines
19 KiB
Diff
Only in silvertunnel.org_netlib/lib/main: bcprov-jdk15-145.jar
|
|
Only in silvertunnel.org-netlib-0.14-briar/lib/main: sc-light-jdk15on-1.47.0.3-SNAPSHOT.jar
|
|
Only in silvertunnel.org-netlib-0.14-briar/lib/main: scpkix-jdk15on-1.47.0.3-SNAPSHOT.jar
|
|
Only in silvertunnel.org-netlib-0.14-briar/lib/main: scprov-jdk15on-1.47.0.3-SNAPSHOT.jar
|
|
Only in silvertunnel.org_netlib/src/main/java: com
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/api/impl/SocketTimeoutInputStream.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/api/impl/SocketTimeoutInputStream.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/api/impl/SocketTimeoutInputStream.java 2012-01-19 16:46:10.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/api/impl/SocketTimeoutInputStream.java 2012-12-18 02:51:40.167913821 +0000
|
|
@@ -111,7 +111,7 @@
|
|
synchronized (this) {
|
|
throwLastPendingIOException();
|
|
if (thread != null) {
|
|
- throw new SocketTimeoutException();
|
|
+ throw new SocketTimeoutException(String.valueOf(timeout));
|
|
}
|
|
}
|
|
}
|
|
@@ -217,7 +217,9 @@
|
|
}
|
|
notify();
|
|
try {
|
|
- wait(timeout);
|
|
+ long atomic = timeout;
|
|
+ if(atomic == 0) wait();
|
|
+ else wait(atomic);
|
|
} catch (InterruptedException e) {
|
|
// unexpected
|
|
Thread.currentThread().interrupt();
|
|
@@ -231,7 +233,7 @@
|
|
// EOF reached
|
|
return false;
|
|
}
|
|
- throw new SocketTimeoutException();
|
|
+ throw new SocketTimeoutException(String.valueOf(timeout));
|
|
}
|
|
|
|
/**
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/circuit/TLSDispatcherThread.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/circuit/TLSDispatcherThread.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/circuit/TLSDispatcherThread.java 2012-08-24 15:57:00.000000000 +0100
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/circuit/TLSDispatcherThread.java 2012-12-17 21:58:30.943914693 +0000
|
|
@@ -70,13 +70,13 @@
|
|
|
|
public void run() {
|
|
boolean dispatched = false;
|
|
- while(!stopped) {
|
|
+ for(int i = 0; !stopped; i++) {
|
|
// read next data-packet
|
|
Cell cell = null;
|
|
try {
|
|
cell = new Cell(sin);
|
|
} catch (IOException e) {
|
|
- log.info("TLSDispatcher.run: connection error: "+e.getMessage());
|
|
+ log.log(Level.INFO, "TLSDispatcher.run: connection error after " + i + " cells", e);
|
|
stopped = true;
|
|
break;
|
|
}
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/clientimpl/Tor.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/clientimpl/Tor.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/clientimpl/Tor.java 2012-01-20 11:16:16.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/clientimpl/Tor.java 2012-11-16 18:38:24.138140251 +0000
|
|
@@ -131,11 +131,11 @@
|
|
|
|
|
|
private void initLocalSystem(boolean noLocalFileSystemAccess) throws IOException {
|
|
- // install BC, if not already done
|
|
- if (Security.getProvider("BC") == null) {
|
|
- Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
|
|
+ // install SC, if not already done
|
|
+ if (Security.getProvider("SC") == null) {
|
|
+ Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider());
|
|
// Security.insertProviderAt(new
|
|
- // org.bouncycastle.jce.provider.BouncyCastleProvider(),2);
|
|
+ // org.spongycastle.jce.provider.BouncyCastleProvider(),2);
|
|
}
|
|
// logger and config
|
|
log.info("Tor implementation of silvertunnel.org is starting up");
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/common/LookupServiceUtil.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/common/LookupServiceUtil.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/common/LookupServiceUtil.java 2012-01-19 16:46:10.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/common/LookupServiceUtil.java 2013-01-10 16:18:14.861709367 +0000
|
|
@@ -18,11 +18,6 @@
|
|
package org.silvertunnel.netlib.layer.tor.common;
|
|
|
|
import java.net.InetAddress;
|
|
-import java.util.logging.Level;
|
|
-import java.util.logging.Logger;
|
|
-
|
|
-
|
|
-import com.maxmind.geoip.LookupService;
|
|
|
|
/**
|
|
* Helper class to access LookupService.
|
|
@@ -30,18 +25,6 @@
|
|
* @author hapke
|
|
*/
|
|
public class LookupServiceUtil {
|
|
- private static final Logger log = Logger.getLogger(LookupServiceUtil.class.getName());
|
|
-
|
|
-
|
|
- private static LookupService lookupService;
|
|
-
|
|
- static {
|
|
- try {
|
|
- lookupService = new LookupService(LookupServiceUtil.class.getResourceAsStream(TorConfig.TOR_GEOIPCITY_PATH), TorConfig.TOR_GEOIPCITY_MAX_FILE_SIZE);
|
|
- } catch (Exception e) {
|
|
- log.log(Level.SEVERE, "LookupService could not be initialized", e);
|
|
- }
|
|
- }
|
|
|
|
/**
|
|
* Determine the country code of an IP address.
|
|
@@ -50,15 +33,6 @@
|
|
* @return the countryCode; ?? if it could not be determined
|
|
*/
|
|
public static String getCountryCodeOfIpAddress(InetAddress address) {
|
|
- String countryCode = null;
|
|
- if (lookupService!=null) {
|
|
- countryCode = lookupService.getCountry(address.getAddress()).getCode();
|
|
- }
|
|
-
|
|
- if (countryCode == null || countryCode.length()<1) {
|
|
return "??";
|
|
- } else {
|
|
- return countryCode;
|
|
- }
|
|
}
|
|
}
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/directory/HiddenServiceProperties.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/directory/HiddenServiceProperties.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/directory/HiddenServiceProperties.java 2011-03-25 09:56:20.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/directory/HiddenServiceProperties.java 2012-11-16 18:48:45.354224491 +0000
|
|
@@ -64,7 +64,7 @@
|
|
minimumNumberOfIntroPoints = 3;
|
|
try {
|
|
// generates a new random key pair on every start.
|
|
- KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "BC");
|
|
+ KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "SC");
|
|
generator.initialize(1024, new SecureRandom());
|
|
KeyPair keypair = generator.generateKeyPair();
|
|
pub = (RSAPublicKey) keypair.getPublic();
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/directory/RouterImpl.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/directory/RouterImpl.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/directory/RouterImpl.java 2012-09-02 11:58:16.000000000 +0100
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/directory/RouterImpl.java 2013-01-04 00:34:36.209293886 +0000
|
|
@@ -156,7 +156,7 @@
|
|
PLATFORM_PATTERN = Parsing.compileRegexPattern("^platform (.*?)$");
|
|
PUBLISHED_PATTERN = Parsing.compileRegexPattern("^published (.*?)$");
|
|
UPTIME_PATTERN = Parsing.compileRegexPattern("^uptime (\\d+)");
|
|
- FINGERPRINT_PATTERN = Parsing.compileRegexPattern("^opt fingerprint (.*?)$");
|
|
+ FINGERPRINT_PATTERN = Parsing.compileRegexPattern("^(?:opt )?fingerprint (.*?)$");
|
|
CONTACT_PATTERN = Parsing.compileRegexPattern("^contact (.*?)$");
|
|
ROUTER_PATTERN2 = Parsing.compileRegexPattern("^bandwidth (\\d+) (\\d+) (\\d+)?");
|
|
ONIONKEY_PATTERN = Parsing.compileRegexPattern("^onion-key\n(.*?END RSA PUBLIC KEY......)");
|
|
@@ -477,7 +477,7 @@
|
|
try {
|
|
fingerprint = new FingerprintImpl(Encoding.parseHex(Parsing.parseStringByRE(rd, FINGERPRINT_PATTERN, "")));
|
|
} catch (Exception e) {
|
|
- throw new TorException("Server " + nickname + " skipped as router");
|
|
+ throw new TorException("Server " + nickname + " skipped as router: " + e);
|
|
}
|
|
contact = Parsing.parseStringByRE(rd, CONTACT_PATTERN, "");
|
|
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encoding.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encoding.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encoding.java 2012-01-19 16:46:10.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encoding.java 2012-11-16 18:37:17.762139243 +0000
|
|
@@ -250,7 +250,7 @@
|
|
|
|
/** creates an base64-string out of a byte[] */
|
|
public static String toBase64(byte[] data) {
|
|
- return new String(org.bouncycastle.util.encoders.Base64.encode(data));
|
|
+ return new String(org.spongycastle.util.encoders.Base64.encode(data));
|
|
}
|
|
|
|
/**
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encryption.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encryption.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encryption.java 2012-01-19 16:46:10.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/util/Encryption.java 2012-11-20 15:27:08.128469232 +0000
|
|
@@ -60,21 +60,22 @@
|
|
|
|
import javax.crypto.Cipher;
|
|
|
|
-import org.bouncycastle.asn1.ASN1InputStream;
|
|
-import org.bouncycastle.asn1.ASN1OutputStream;
|
|
-import org.bouncycastle.asn1.ASN1Sequence;
|
|
-import org.bouncycastle.asn1.x509.RSAPublicKeyStructure;
|
|
-import org.bouncycastle.crypto.InvalidCipherTextException;
|
|
-import org.bouncycastle.crypto.encodings.OAEPEncoding;
|
|
-import org.bouncycastle.crypto.encodings.PKCS1Encoding;
|
|
-import org.bouncycastle.crypto.engines.RSAEngine;
|
|
-import org.bouncycastle.crypto.params.RSAKeyParameters;
|
|
-import org.bouncycastle.jce.provider.JCERSAPrivateCrtKey;
|
|
-import org.bouncycastle.jce.provider.JCERSAPrivateKey;
|
|
-import org.bouncycastle.jce.provider.JCERSAPublicKey;
|
|
-import org.bouncycastle.openssl.PEMReader;
|
|
-import org.bouncycastle.openssl.PEMWriter;
|
|
-import org.bouncycastle.util.encoders.Base64;
|
|
+import org.spongycastle.asn1.ASN1InputStream;
|
|
+import org.spongycastle.asn1.ASN1OutputStream;
|
|
+import org.spongycastle.asn1.ASN1Sequence;
|
|
+import org.spongycastle.asn1.x509.RSAPublicKeyStructure;
|
|
+import org.spongycastle.crypto.InvalidCipherTextException;
|
|
+import org.spongycastle.crypto.encodings.OAEPEncoding;
|
|
+import org.spongycastle.crypto.encodings.PKCS1Encoding;
|
|
+import org.spongycastle.crypto.engines.RSAEngine;
|
|
+import org.spongycastle.crypto.params.RSAKeyParameters;
|
|
+import org.spongycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey;
|
|
+import org.spongycastle.jce.provider.JCERSAPrivateCrtKey;
|
|
+import org.spongycastle.jce.provider.JCERSAPrivateKey;
|
|
+import org.spongycastle.jce.provider.JCERSAPublicKey;
|
|
+import org.spongycastle.openssl.PEMReader;
|
|
+import org.spongycastle.openssl.PEMWriter;
|
|
+import org.spongycastle.util.encoders.Base64;
|
|
|
|
|
|
|
|
@@ -94,11 +95,11 @@
|
|
|
|
static {
|
|
try {
|
|
- // install BC, if not already done
|
|
- if (Security.getProvider("BC") == null) {
|
|
- Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
|
|
+ // install SC, if not already done
|
|
+ if (Security.getProvider("SC") == null) {
|
|
+ Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider());
|
|
// Security.insertProviderAt(new
|
|
- // org.bouncycastle.jce.provider.BouncyCastleProvider(),2);
|
|
+ // org.spongycastle.jce.provider.BouncyCastleProvider(),2);
|
|
}
|
|
} catch (Throwable t) {
|
|
log.log(Level.SEVERE, "Cannot initialize class Encryption", t);
|
|
@@ -340,11 +341,15 @@
|
|
try {
|
|
PEMReader reader = new PEMReader(new StringReader(s));
|
|
Object o = reader.readObject();
|
|
- if (!(o instanceof JCERSAPublicKey)) {
|
|
+ if (o instanceof JCERSAPublicKey) {
|
|
+ JCERSAPublicKey jceKey = (JCERSAPublicKey) o;
|
|
+ theKey = getRSAPublicKey(jceKey.getModulus(), jceKey.getPublicExponent());
|
|
+ } else if (o instanceof BCRSAPublicKey) {
|
|
+ BCRSAPublicKey bcKey = (BCRSAPublicKey) o;
|
|
+ theKey = getRSAPublicKey(bcKey.getModulus(), bcKey.getPublicExponent());
|
|
+ } else {
|
|
throw new IOException("Encryption.extractPublicRSAKey: no public key found in string '" + s + "'");
|
|
}
|
|
- JCERSAPublicKey JCEKey = (JCERSAPublicKey) o;
|
|
- theKey = getRSAPublicKey(JCEKey.getModulus(), JCEKey.getPublicExponent());
|
|
|
|
} catch (Exception e) {
|
|
log.warning("Encryption.extractPublicRSAKey: Caught exception:" + e.getMessage());
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/util/PrivateKeyHandler.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/util/PrivateKeyHandler.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/layer/tor/util/PrivateKeyHandler.java 2011-03-25 09:56:22.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/layer/tor/util/PrivateKeyHandler.java 2012-11-16 18:48:53.282158910 +0000
|
|
@@ -50,7 +50,7 @@
|
|
*/
|
|
public PrivateKeyHandler() {
|
|
try {
|
|
- KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "BC");
|
|
+ KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "SC");
|
|
generator.initialize(1024, new SecureRandom());
|
|
keypair = generator.generateKeyPair();
|
|
} catch (Exception e) {
|
|
@@ -78,16 +78,16 @@
|
|
|
|
public java.security.cert.X509Certificate[] getCertificateChain(String alias) {
|
|
try {
|
|
- org.bouncycastle.x509.X509V3CertificateGenerator generator = new org.bouncycastle.x509.X509V3CertificateGenerator();
|
|
+ org.spongycastle.x509.X509V3CertificateGenerator generator = new org.spongycastle.x509.X509V3CertificateGenerator();
|
|
generator.reset();
|
|
generator.setSerialNumber(BigInteger.valueOf(42));
|
|
generator.setNotBefore(new Date( System.currentTimeMillis() - 24L * 3600 * 1000));
|
|
generator.setNotAfter(new Date(System.currentTimeMillis() + 365L * 24 * 3600 * 1000));
|
|
- generator.setIssuerDN(new org.bouncycastle.asn1.x509.X509Name( "CN="+Util.MYNAME));
|
|
- generator.setSubjectDN(new org.bouncycastle.asn1.x509.X509Name("CN="+Util.MYNAME));
|
|
+ generator.setIssuerDN(new org.spongycastle.asn1.x509.X509Name( "CN="+Util.MYNAME));
|
|
+ generator.setSubjectDN(new org.spongycastle.asn1.x509.X509Name("CN="+Util.MYNAME));
|
|
generator.setPublicKey(keypair.getPublic());
|
|
generator.setSignatureAlgorithm("SHA1WITHRSA");
|
|
- java.security.cert.X509Certificate x509 = generator.generate(keypair.getPrivate(), "BC");
|
|
+ java.security.cert.X509Certificate x509 = generator.generate(keypair.getPrivate(), "SC");
|
|
java.security.cert.X509Certificate[] x509s = new java.security.cert.X509Certificate[2];
|
|
|
|
// send the same certificate twice works fine with the default implementation of tor!
|
|
diff -Bbur silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/util/Base64.java silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/util/Base64.java
|
|
--- silvertunnel.org_netlib/src/main/java/org/silvertunnel/netlib/util/Base64.java 2012-01-19 16:46:10.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/main/java/org/silvertunnel/netlib/util/Base64.java 2012-11-16 18:37:46.506222108 +0000
|
|
@@ -34,7 +34,7 @@
|
|
*/
|
|
public static String encode(byte[] input) {
|
|
try {
|
|
- return new String(org.bouncycastle.util.encoders.Base64.encode(input), UTF8);
|
|
+ return new String(org.spongycastle.util.encoders.Base64.encode(input), UTF8);
|
|
} catch (Exception e) {
|
|
return null;
|
|
}
|
|
@@ -48,7 +48,7 @@
|
|
*/
|
|
public static byte[] decode(String input) {
|
|
try {
|
|
- return org.bouncycastle.util.encoders.Base64.decode(input);
|
|
+ return org.spongycastle.util.encoders.Base64.decode(input);
|
|
} catch (Exception e) {
|
|
return null;
|
|
}
|
|
Only in silvertunnel.org_netlib/src/main/resources: com
|
|
Only in silvertunnel.org_netlib/src/test/java: com
|
|
diff -Bbur silvertunnel.org_netlib/src/test/java/org/silvertunnel/netlib/layer/tor/directory/AuthorityKeyCertificatesLocalTest.java silvertunnel.org-netlib-0.14-briar/src/test/java/org/silvertunnel/netlib/layer/tor/directory/AuthorityKeyCertificatesLocalTest.java
|
|
--- silvertunnel.org_netlib/src/test/java/org/silvertunnel/netlib/layer/tor/directory/AuthorityKeyCertificatesLocalTest.java 2012-01-19 16:46:08.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/test/java/org/silvertunnel/netlib/layer/tor/directory/AuthorityKeyCertificatesLocalTest.java 2012-11-16 18:38:10.338141454 +0000
|
|
@@ -53,9 +53,9 @@
|
|
|
|
@BeforeClass
|
|
public static void setUpClass() throws Exception {
|
|
- // install BC, if not already done
|
|
- if(Security.getProvider("BC")==null) {
|
|
- Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
|
|
+ // install SC, if not already done
|
|
+ if(Security.getProvider("SC")==null) {
|
|
+ Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider());
|
|
}
|
|
}
|
|
|
|
diff -Bbur silvertunnel.org_netlib/src/test/java/org/silvertunnel/netlib/layer/tor/directory/DirectoryConsensusLocalTest.java silvertunnel.org-netlib-0.14-briar/src/test/java/org/silvertunnel/netlib/layer/tor/directory/DirectoryConsensusLocalTest.java
|
|
--- silvertunnel.org_netlib/src/test/java/org/silvertunnel/netlib/layer/tor/directory/DirectoryConsensusLocalTest.java 2012-01-19 16:46:08.000000000 +0000
|
|
+++ silvertunnel.org-netlib-0.14-briar/src/test/java/org/silvertunnel/netlib/layer/tor/directory/DirectoryConsensusLocalTest.java 2012-11-16 18:38:16.654139552 +0000
|
|
@@ -60,9 +60,9 @@
|
|
|
|
@BeforeClass
|
|
public static void setUpClass() throws Exception {
|
|
- // install BC, if not already done
|
|
- if (Security.getProvider("BC")==null) {
|
|
- Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
|
|
+ // install SC, if not already done
|
|
+ if (Security.getProvider("SC")==null) {
|
|
+ Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider());
|
|
}
|
|
}
|
|
|