[java-xmltooling COMMIT] /branches/REL_1/src/main/java/org/opensaml/xml/encryption/Encrypter.java

noreply at shibboleth.net noreply at shibboleth.net
Fri Jan 4 20:27:29 EST 2013


Author: scantor
Date: Fri Jan  4 20:27:29 2013
New Revision: 770

URL: http://svn.shibboleth.net/view/java-xmltooling?rev=770&view=rev
Log:
EC keys are also invalid for key transport.

Modified:
    branches/REL_1/src/main/java/org/opensaml/xml/encryption/Encrypter.java

Modified: branches/REL_1/src/main/java/org/opensaml/xml/encryption/Encrypter.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/main/java/org/opensaml/xml/encryption/Encrypter.java?rev=770&r1=769&r2=770&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/xml/encryption/Encrypter.java (original)
+++ branches/REL_1/src/main/java/org/opensaml/xml/encryption/Encrypter.java Fri Jan  4 20:27:29 2013
@@ -21,6 +21,7 @@
 import java.security.KeyException;
 import java.security.NoSuchAlgorithmException;
 import java.security.interfaces.DSAPublicKey;
+import java.security.interfaces.ECPublicKey;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -575,12 +576,13 @@
         if (key == null) {
             log.error("Key encryption credential and contained key are required");
             throw new EncryptionException("Key encryption credential and contained key are required");
-        }
-        if (key instanceof DSAPublicKey) {
+        } else if (key instanceof DSAPublicKey) {
             log.error("Attempt made to use DSA key for encrypted key transport");
             throw new EncryptionException("DSA keys may not be used for encrypted key transport");
-        }
-        if (DatatypeHelper.isEmpty(kekParams.getAlgorithm())) {
+        } else if (key instanceof ECPublicKey) {
+            log.error("Attempt made to use EC key for encrypted key transport");
+            throw new EncryptionException("EC keys may not be used for encrypted key transport");
+        } else if (DatatypeHelper.isEmpty(kekParams.getAlgorithm())) {
             log.error("Key encryption algorithm URI is required");
             throw new EncryptionException("Key encryption algorithm URI is required");
         }



More information about the commits mailing list