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 2015/04/22 14:13:22 UTC
svn commit: r1675340 -
/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
Author: coheigea
Date: Wed Apr 22 12:13:21 2015
New Revision: 1675340
URL: http://svn.apache.org/r1675340
Log:
[WSS-536] - WSSecurityUtil.getCipherInstance() does not use configured provider
Conflicts:
ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java
Modified:
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java?rev=1675340&r1=1675339&r2=1675340&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java Wed Apr 22 12:13:21 2015
@@ -50,6 +50,7 @@ import javax.xml.namespace.QName;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -821,7 +822,12 @@ public final class WSSecurityUtil {
throws WSSecurityException {
try {
String keyAlgorithm = JCEMapper.translateURItoJCEID(cipherAlgo);
- return Cipher.getInstance(keyAlgorithm);
+ String provider = JCEMapper.getProviderId();
+
+ if (provider == null) {
+ return Cipher.getInstance(keyAlgorithm);
+ }
+ return Cipher.getInstance(keyAlgorithm, provider);
} catch (NoSuchPaddingException ex) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
@@ -842,6 +848,10 @@ public final class WSSecurityUtil {
WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
ex, "No such algorithm: " + cipherAlgo);
}
+ } catch (NoSuchProviderException ex) {
+ throw new WSSecurityException(
+ WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
+ ex, "No such provider " + JCEMapper.getProviderId() + " for: " + cipherAlgo);
}
}