瀏覽代碼

Added check for maximum AES key size in crypto.gradle to skip tests if limited strength crypto policy files are in place.

Luke Taylor 14 年之前
父節點
當前提交
6b1b012e2c
共有 1 個文件被更改,包括 5 次插入6 次删除
  1. 5 6
      crypto/crypto.gradle

+ 5 - 6
crypto/crypto.gradle

@@ -1,13 +1,12 @@
 // crypto module build file
 
-jdkVersion = System.properties['java.version']
-javaClassVersion = System.properties['java.class.version']
-println "JDK Version is $jdkVersion, class version is $javaClassVersion"
-
-isJdk6 = jdkVersion.startsWith('1.6')
+// jdkVersion = System.properties['java.version']
+// isJdk6 = jdkVersion >= '1.6'
+int maxAESKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength('AES')
 
 test {
-    if (!isJdk6) {
+    if (maxAESKeySize < 256) {
+        println "AES keysize limited to $maxAESKeySize, skipping EncryptorsTests"
         exclude '**/EncryptorsTests.class'
     }
 }