diff --git a/src/nodash/core/NoUtil.java b/src/nodash/core/NoUtil.java index 45a2a2f..3dbb649 100644 --- a/src/nodash/core/NoUtil.java +++ b/src/nodash/core/NoUtil.java @@ -48,7 +48,7 @@ public final class NoUtil { public static final String KEYPAIR_ALGORITHM = "RSA"; public static final String SECURERANDOM_ALGORITHM = "SHA1PRNG"; 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 byte BLANK_BYTE = 'A'; @@ -61,6 +61,15 @@ public final class NoUtil { 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) { char[] result = new char[array.length];