You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2016/01/07 15:27:18 UTC

svn commit: r1723560 - in /webservices/wss4j/branches/2_1_x-fixes: ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Crypto.java ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java

Author: coheigea
Date: Thu Jan  7 14:27:18 2016
New Revision: 1723560

URL: http://svn.apache.org/viewvc?rev=1723560&view=rev
Log:
Remove method from Crypto interface

Modified:
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Crypto.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Crypto.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Crypto.java?rev=1723560&r1=1723559&r2=1723560&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Crypto.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Crypto.java Thu Jan  7 14:27:18 2016
@@ -169,18 +169,6 @@ public interface Crypto {
     ) throws WSSecurityException;
     
     /**
-     * Gets the private key corresponding to the given PublicKey.
-     *
-     * @param publicKey The PublicKey corresponding to the private key
-     * @param callbackHandler The callbackHandler needed to get the password
-     * @return The private key
-     */
-    PrivateKey getPrivateKey(
-        PublicKey publicKey,
-        CallbackHandler callbackHandler
-    ) throws WSSecurityException;
-
-    /**
      * Gets the private key corresponding to the identifier.
      *
      * @param identifier The implementation-specific identifier corresponding to the key

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java?rev=1723560&r1=1723559&r2=1723560&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java Thu Jan  7 14:27:18 2016
@@ -47,6 +47,7 @@ import org.apache.wss4j.common.bsp.BSPRu
 import org.apache.wss4j.common.crypto.AlgorithmSuite;
 import org.apache.wss4j.common.crypto.AlgorithmSuiteValidator;
 import org.apache.wss4j.common.crypto.CryptoType;
+import org.apache.wss4j.common.crypto.Merlin;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.token.DOMX509IssuerSerial;
 import org.apache.wss4j.common.token.SecurityTokenReference;
@@ -250,8 +251,10 @@ public class EncryptedKeyProcessor imple
         try {
             if (certs != null) {
                 return data.getDecCrypto().getPrivateKey(certs[0], data.getCallbackHandler());
+            } else if (data.getDecCrypto() instanceof Merlin) {
+                return ((Merlin)data.getDecCrypto()).getPrivateKey(publicKey, data.getCallbackHandler());
             }
-            return data.getDecCrypto().getPrivateKey(publicKey, data.getCallbackHandler());
+            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK);
         } catch (WSSecurityException ex) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK, ex);
         }