[java-opensaml COMMIT] in /trunk/opensaml-saml-impl: pom.xml src/test/java/org/opensaml/saml/security/impl/SAMLMetada...

noreply at shibboleth.net noreply at shibboleth.net
Thu Sep 25 18:21:23 EDT 2014


Author: putmanb
Date: Thu Sep 25 18:21:23 2014
New Revision: 4073

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4073&view=rev
Log:
Load BC in unit test so can properly test OAEP 1.1 stuff.

Modified:
    trunk/opensaml-saml-impl/pom.xml
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/security/impl/SAMLMetadataEncryptionParametersResolverTest.java

Modified: trunk/opensaml-saml-impl/pom.xml
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/pom.xml?rev=4073&r1=4072&r2=4073&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/pom.xml (original)
+++ trunk/opensaml-saml-impl/pom.xml Thu Sep 25 18:21:23 2014
@@ -124,6 +124,13 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>opensaml-security-api</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>net.shibboleth.ext</groupId>
             <artifactId>spring-extensions</artifactId>
             <scope>test</scope>

Modified: trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/security/impl/SAMLMetadataEncryptionParametersResolverTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/security/impl/SAMLMetadataEncryptionParametersResolverTest.java?rev=4073&r1=4072&r2=4073&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/security/impl/SAMLMetadataEncryptionParametersResolverTest.java (original)
+++ trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/security/impl/SAMLMetadataEncryptionParametersResolverTest.java Thu Sep 25 18:21:23 2014
@@ -35,6 +35,8 @@
 import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 import net.shibboleth.utilities.java.support.resolver.ResolverException;
 
+import org.opensaml.core.config.ConfigurationService;
+import org.opensaml.core.config.InitializationException;
 import org.opensaml.core.xml.XMLObjectBaseTestCase;
 import org.opensaml.saml.common.SAMLTestSupport;
 import org.opensaml.saml.criterion.RoleDescriptorCriterion;
@@ -43,6 +45,7 @@
 import org.opensaml.saml.saml2.metadata.KeyDescriptor;
 import org.opensaml.saml.saml2.metadata.RoleDescriptor;
 import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
+import org.opensaml.security.SecurityProviderTestSupport;
 import org.opensaml.security.credential.Credential;
 import org.opensaml.security.credential.CredentialSupport;
 import org.opensaml.security.credential.UsageType;
@@ -50,6 +53,9 @@
 import org.opensaml.security.crypto.KeySupport;
 import org.opensaml.xmlsec.EncryptionParameters;
 import org.opensaml.xmlsec.KeyTransportAlgorithmPredicate;
+import org.opensaml.xmlsec.algorithm.AlgorithmRegistry;
+import org.opensaml.xmlsec.algorithm.AlgorithmSupport;
+import org.opensaml.xmlsec.config.GlobalAlgorithmRegistryInitializer;
 import org.opensaml.xmlsec.criterion.EncryptionConfigurationCriterion;
 import org.opensaml.xmlsec.criterion.KeyInfoGenerationProfileCriterion;
 import org.opensaml.xmlsec.encryption.MGF;
@@ -102,6 +108,12 @@
     private RoleDescriptor roleDesc;
     
     private String targetEntityID = "urn:test:foo";
+    
+    private SecurityProviderTestSupport providerSupport;
+    
+    public SAMLMetadataEncryptionParametersResolverTest() {
+        providerSupport = new SecurityProviderTestSupport();
+    }
     
     @BeforeClass
     public void buildCredentials() throws NoSuchAlgorithmException, NoSuchProviderException {
@@ -304,7 +316,7 @@
     }
     
     @Test
-    public void testEncryptionMethodWithRSAOAEPParameters() throws ResolverException {
+    public void testEncryptionMethodWithRSAOAEPParameters() throws ResolverException, InitializationException {
         EncryptionParameters params;
         EncryptionMethod rsaEncryptionMethod;
         DigestMethod digestMethod;
@@ -329,70 +341,80 @@
         Assert.assertNotNull(params.getRSAOAEPParameters());
         Assert.assertTrue(params.getRSAOAEPParameters().isEmpty());
         
-        // Note: in tests below, having an MGF with RSAOAEP (vs RSAOAEP11) doesn't technically make sense,
-        // but here it doesn't matter and we can't really test RSAOAEP11 directly b/c it isn't runtime supported on Java 7
-        // without BC.
-        
-        // Should resolve digest from metadata
-        rsaEncryptionMethod = buildEncryptionMethod(EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP);
-        digestMethod = buildXMLObject(DigestMethod.DEFAULT_ELEMENT_NAME);
-        digestMethod.setAlgorithm(EncryptionConstants.ALGO_ID_DIGEST_SHA256);
-        rsaEncryptionMethod.getUnknownXMLObjects().add(digestMethod);
-        keyDescriptor.getEncryptionMethods().clear();
-        keyDescriptor.getEncryptionMethods().add(rsaEncryptionMethod);

[... 131 lines stripped ...]


More information about the commits mailing list