[java-opensaml COMMIT] in /trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec: algorithm/AlgorithmSupport.ja...

noreply at shibboleth.net noreply at shibboleth.net
Fri Sep 19 15:31:43 EDT 2014


Author: putmanb
Date: Fri Sep 19 15:31:43 2014
New Revision: 4021

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4021&view=rev
Log:
Add support method for determining RSA-OAEP algos.

Modified:
    trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
    trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java

Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java?rev=4021&r1=4020&r2=4021&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java (original)
+++ trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/algorithm/AlgorithmSupport.java Fri Sep 19 15:31:43 2014
@@ -36,6 +36,7 @@
 import org.opensaml.security.credential.Credential;
 import org.opensaml.security.credential.CredentialSupport;
 import org.opensaml.security.crypto.KeySupport;
+import org.opensaml.xmlsec.encryption.support.EncryptionConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -236,6 +237,17 @@
     }
 
     /**
+     * Check whether the key transport encryption algorithm URI indicates RSA-OAEP.
+     * 
+     * @param keyTransportAlgorithm the key transport encryption algorithm URI
+     * @return true if URI indicates RSA-OAEP, false otherwise
+     */
+    public static boolean isRSAOAEP(@Nonnull final String keyTransportAlgorithm) {
+        return EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP.equals(keyTransportAlgorithm)
+                || EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP11.equals(keyTransportAlgorithm);
+    }
+    
+    /**
      * Check whether the signature method algorithm URI indicates HMAC.
      * 
      * @param signatureAlgorithm the signature method algorithm URI

Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java?rev=4021&r1=4020&r2=4021&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java (original)
+++ trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/encryption/support/Encrypter.java Fri Sep 19 15:31:43 2014
@@ -416,17 +416,6 @@
         
         return xmlCipher;
     }
-
-    /**
-     * Determine whether key encryption algorithm URI is an RSA OAEP variant.
-     * 
-     * @param encryptionAlgorithmURI the algorithm URI
-     * @return true if is RSA OAEP, false otherwise
-     */
-    protected boolean isRSAOAEP(String encryptionAlgorithmURI) {
-        return EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP.equals(encryptionAlgorithmURI) 
-                || EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSAOAEP11.equals(encryptionAlgorithmURI);
-    }
     
     /**
      * Get the effective RSA OAEP mask generation function (MGF) to use.
@@ -491,7 +480,7 @@
         // Workaround for XML-Security library issue. To maximize interop, explicitly express the library
         // default of SHA-1 digest method input parameter to RSA-OAEP key transport algorithm.
         // Check and only add if the library hasn't already done so, which it currently doesn't.
-        if (isRSAOAEP(encryptionAlgorithmURI)) {
+        if (AlgorithmSupport.isRSAOAEP(encryptionAlgorithmURI)) {
             boolean sawDigestMethod = false;
             Iterator childIter = apacheEncryptedKey.getEncryptionMethod().getEncryptionMethodInformation();
             while (childIter.hasNext()) {



More information about the commits mailing list