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';
@@ -61,6 +61,15 @@ public final class NoUtil {
return new SecretKeySpec(encoded, 0, encoded.length, NoUtil.CIPHER_KEY_SPEC); return new SecretKeySpec(encoded, 0, encoded.length, NoUtil.CIPHER_KEY_SPEC);
} }
} }
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];