* CryptoChecker: Log tweaks, handle gij

This commit is contained in:
zzz
2014-09-02 14:11:22 +00:00
parent c6b1f5053f
commit 5d5a68cb3e
3 changed files with 25 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2014-08-31 zzz
* Build: Add support for bundling router infos in the package
* I2PTunnel: Allow changing of spoof host and target host/port without
restarting server tunnel
2014-08-30 zzz
* Console:
- Re-enable plugin installation by default

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 13;
public final static long BUILD = 14;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -1,7 +1,9 @@
package net.i2p.router.tasks;
import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import net.i2p.crypto.SigType;
import net.i2p.router.RouterContext;
@ -16,8 +18,9 @@ import net.i2p.util.SystemVersion;
public class CryptoChecker {
private static String JRE6 = "http://www.oracle.com/technetwork/java/javase/downloads/index.html";
private static String JRE7 = "http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html";
private static String JRE8 = "http://www.oracle.com/technetwork/java/javase/documentation/jdk8-doc-downloads-2133158.html";
// these two are US-only and can change?
//private static String JRE7 = "http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html";
//private static String JRE8 = "http://www.oracle.com/technetwork/java/javase/documentation/jdk8-doc-downloads-2133158.html";
public static void warnUnavailableCrypto(RouterContext ctx) {
if (SystemVersion.isAndroid())
@ -43,11 +46,11 @@ public class CryptoChecker {
}
if (!isUnlimited()) {
String s = "Please consider installing the Java Cryptography Unlimited Strength Jurisdiction Policy Files from ";
if (SystemVersion.isJava8())
s += JRE8;
else if (SystemVersion.isJava7())
s += JRE7;
else
//if (SystemVersion.isJava8())
// s += JRE8;
//else if (SystemVersion.isJava7())
// s += JRE7;
//else
s += JRE6;
log.logAlways(log.WARN, s);
System.out.println(s);
@ -59,9 +62,7 @@ public class CryptoChecker {
}
/**
* Following code adapted from Orchid
* According to http://www.subgraph.com/orchid.html ,
* "Orchid is licensed under a three-clause BSD license."
* Copied from CryptixAESEngine
*/
private static boolean isUnlimited() {
try {
@ -70,6 +71,14 @@ public class CryptoChecker {
} catch (NoSuchAlgorithmException e) {
return false;
} catch (NoSuchMethodError e) {
// JamVM, gij
try {
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec key = new SecretKeySpec(new byte[32], "AES");
cipher.init(Cipher.ENCRYPT_MODE, key);
} catch (GeneralSecurityException gse) {
return false;
}
}
return true;
}