enabled env RSA strength

This commit is contained in:
Dave
2015-09-06 22:30:01 +02:00
parent 7f137556aa
commit 21669a1477

View File

@@ -48,7 +48,7 @@ public final class NoUtil {
public static final String KEYPAIR_ALGORITHM = "RSA"; public static final String KEYPAIR_ALGORITHM = "RSA";
public static final String SECURERANDOM_ALGORITHM = "SHA1PRNG"; public static final String SECURERANDOM_ALGORITHM = "SHA1PRNG";
public static final String SECURERANDOM_PROVIDER = "SUN"; public static final String SECURERANDOM_PROVIDER = "SUN";
public static final int RSA_STRENGTH = 4096; public static final int RSA_STRENGTH = setupRsaStrength();
public static final int AES_STRENGTH = 256; public static final int AES_STRENGTH = 256;
public static final byte BLANK_BYTE = 'A'; public static final byte BLANK_BYTE = 'A';
@@ -62,6 +62,15 @@ public final class NoUtil {
} }
} }
private static int setupRsaStrength() {
String secretEnv = System.getenv("NODASH_RSA_STRENGTH");
if (secretEnv == null) {
return 4096;
} else {
return Integer.parseInt(secretEnv);
}
}
public static char[] bytesToChars(byte[] array) { public static char[] bytesToChars(byte[] array) {
char[] result = new char[array.length]; char[] result = new char[array.length];
for (int x = 0; x < array.length; x++) { for (int x = 0; x < array.length; x++) {