[java-opensaml COMMIT] in /trunk/opensaml-xmlsec-impl/src/test: java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupport...

noreply at shibboleth.net noreply at shibboleth.net
Sat May 24 14:44:42 EDT 2014


Author: putmanb
Date: Sat May 24 14:44:41 2014
New Revision: 3894

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3894&view=rev
Log:
In AlgorithmRuntimeSupportedPredicate unit tests, account for OpenJDK 7 not supporting ECDSA signature algorithms.
Add tests for SHA-224 and DSA SHA-256.

Modified:
    trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java
    trunk/opensaml-xmlsec-impl/src/test/resources/logback-test.xml

Modified: trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java?rev=3894&r1=3893&r2=3894&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java (original)
+++ trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java Sat May 24 14:44:41 2014
@@ -52,11 +52,6 @@
         Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA384));
         Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA512));
         
-        Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1));
-        Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA256));
-        Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA384));
-        Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA512));
-        
         Assert.assertTrue(predicate.apply(EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSA15));
         Assert.assertTrue(predicate.apply(EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP));
         
@@ -79,12 +74,41 @@
         predicate = new AlgorithmRuntimeSupportedPredicate(AlgorithmSupport.getGlobalAlgorithmRegistry());
         */
         
+        if (haveSunEC() || haveBouncyCastle() || getJavaVersion() >= 8) {
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1));
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA256));
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA384));
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA512));
+            
+            if (haveBouncyCastle() || getJavaVersion() >= 8) {
+                Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA224));
+            }
+        } else {
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1));
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA224));
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA256));
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA384));
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA512));
+        }
+        
         if (haveBouncyCastle() || getJavaVersion() >= 8) {
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_DIGEST_SHA224));
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA224));
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_MAC_HMAC_SHA224));
+            
+            Assert.assertTrue(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_DSA_SHA256));
+            
             Assert.assertTrue(predicate.apply(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128_GCM));
             Assert.assertTrue(predicate.apply(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES192_GCM));
             Assert.assertTrue(predicate.apply(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256_GCM));
             Assert.assertTrue(predicate.apply(EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP11));
         } else {
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_DIGEST_SHA224));
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA224));
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_MAC_HMAC_SHA224));
+            
+            Assert.assertFalse(predicate.apply(SignatureConstants.ALGO_ID_SIGNATURE_DSA_SHA256));
+            
             Assert.assertFalse(predicate.apply(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128_GCM));
             Assert.assertFalse(predicate.apply(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES192_GCM));
             Assert.assertFalse(predicate.apply(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256_GCM));
@@ -102,6 +126,9 @@
         }
     }
     
+    private boolean haveSunEC() {
+        return Security.getProvider("SunEC") != null; 
+     }
     
     private boolean haveBouncyCastle() {

[... 19 lines stripped ...]


More information about the commits mailing list