[java-opensaml COMMIT] in /trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl: BasicEncryptionParamete...

noreply at shibboleth.net noreply at shibboleth.net
Wed Apr 9 21:39:24 EDT 2014


Author: putmanb
Date: Wed Apr  9 21:39:23 2014
New Revision: 3776

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3776&view=rev
Log:
Add some encryption and signing params resolver validation logic.

Modified:
    trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicEncryptionParametersResolver.java
    trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicSignatureSigningParametersResolver.java

Modified: trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicEncryptionParametersResolver.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicEncryptionParametersResolver.java?rev=3776&r1=3775&r2=3776&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicEncryptionParametersResolver.java (original)
+++ trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicEncryptionParametersResolver.java Wed Apr  9 21:39:23 2014
@@ -164,8 +164,24 @@
      * @throws ResolverException if params instance is not populated with all required data
      */
     protected void validate(@Nonnull final EncryptionParameters params) throws ResolverException {
-        // TODO Auto-generated method stub
-        
+        if (params.getKeyTransportEncryptionCredential() == null 
+                && params.getDataEncryptionCredential() == null) {
+            throw new ResolverException("Failed to resolve both a data and a key encryption credential");
+        }
+        if (params.getKeyTransportEncryptionCredential() != null 
+                && params.getKeyTransportEncryptionAlgorithmURI() == null) {
+            throw new ResolverException("Unable to resolve key encryption algorithm URI for credential");
+        }
+        if (params.getDataEncryptionCredential() != null 
+                && params.getDataEncryptionAlgorithmURI() == null) {
+            throw new ResolverException("Unable to resolve data encryption algorithm URI for credential");
+        }
+        if (params.getKeyTransportEncryptionCredential() != null 
+                && params.getDataEncryptionCredential() == null
+                && params.getDataEncryptionAlgorithmURI() == null) {
+            throw new ResolverException("Unable to resolve a data encryption algorithm URI " 
+                    + "for auto-generation of data encryption key");
+        }
     }
 
     /**

Modified: trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicSignatureSigningParametersResolver.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicSignatureSigningParametersResolver.java?rev=3776&r1=3775&r2=3776&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicSignatureSigningParametersResolver.java (original)
+++ trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/impl/BasicSignatureSigningParametersResolver.java Wed Apr  9 21:39:23 2014
@@ -143,8 +143,18 @@
      * @throws ResolverException if params instance is not populated with all required data
      */
     protected void validate(@Nonnull final SignatureSigningParameters params) throws ResolverException {
-        // TODO Auto-generated method stub
-        
+        if (params.getSigningCredential() == null) {
+            throw new ResolverException("Unable to resolve signing credential");
+        }
+        if (params.getSignatureAlgorithmURI() == null) {
+            throw new ResolverException("Unable to resolve signing algorithm URI");
+        }
+        if (params.getSignatureCanonicalizationAlgorithm() == null) {
+            throw new ResolverException("Unable to resolve signing canonicalization algorithm URI");
+        }
+        if (params.getSignatureReferenceDigestMethod() == null) {
+            throw new ResolverException("Unable to resolve reference digest algorithm URI");
+        }
     }
 
     /**



More information about the commits mailing list