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/11 13:17:09 UTC
svn commit: r1724016 - in
/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken:
DsaKeyValueSecurityTokenImpl.java ECKeyValueSecurityTokenImpl.java
RsaKeyValueSecurityTokenImpl.java
Author: coheigea
Date: Mon Jan 11 12:17:08 2016
New Revision: 1724016
URL: http://svn.apache.org/viewvc?rev=1724016&view=rev
Log:
Fixing merge
Modified:
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java
webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java?rev=1724016&r1=1724015&r2=1724016&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java Mon Jan 11 12:17:08 2016
@@ -26,6 +26,7 @@ import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import org.apache.wss4j.common.crypto.Crypto;
+import org.apache.wss4j.common.crypto.Merlin;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.common.principal.PublicKeyPrincipalImpl;
import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
@@ -66,18 +67,21 @@ public class DsaKeyValueSecurityTokenImp
@Override
public Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
String correlationID) throws XMLSecurityException {
- PublicKey publicKey = getPublicKey();
-
- try {
- return crypto.getPrivateKey(publicKey, callbackHandler);
- } catch (WSSecurityException ex) {
- // Check to see if we are decrypting rather than signature verification
- Crypto decCrypto = securityProperties.getDecryptionCrypto();
- if (decCrypto != null && decCrypto != crypto) {
- return decCrypto.getPrivateKey(publicKey, callbackHandler);
+ if (crypto instanceof Merlin) {
+ PublicKey publicKey = getPublicKey();
+
+ try {
+ return ((Merlin)crypto).getPrivateKey(publicKey, callbackHandler);
+ } catch (WSSecurityException ex) {
+ // Check to see if we are decrypting rather than signature verification
+ Crypto decCrypto = securityProperties.getDecryptionCrypto();
+ if (decCrypto instanceof Merlin && decCrypto != crypto) {
+ return ((Merlin)decCrypto).getPrivateKey(publicKey, callbackHandler);
+ }
+ throw ex;
}
- throw ex;
}
+ return super.getKey(algorithmURI, algorithmUsage, correlationID);
}
@Override
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java?rev=1724016&r1=1724015&r2=1724016&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java Mon Jan 11 12:17:08 2016
@@ -26,6 +26,7 @@ import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import org.apache.wss4j.common.crypto.Crypto;
+import org.apache.wss4j.common.crypto.Merlin;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.common.principal.PublicKeyPrincipalImpl;
import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
@@ -67,18 +68,21 @@ public class ECKeyValueSecurityTokenImpl
@Override
public Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
String correlationID) throws XMLSecurityException {
- PublicKey publicKey = getPublicKey();
-
- try {
- return crypto.getPrivateKey(publicKey, callbackHandler);
- } catch (WSSecurityException ex) {
- // Check to see if we are decrypting rather than signature verification
- Crypto decCrypto = securityProperties.getDecryptionCrypto();
- if (decCrypto != null && decCrypto != crypto) {
- return decCrypto.getPrivateKey(publicKey, callbackHandler);
+ if (crypto instanceof Merlin) {
+ PublicKey publicKey = getPublicKey();
+
+ try {
+ return ((Merlin)crypto).getPrivateKey(publicKey, callbackHandler);
+ } catch (WSSecurityException ex) {
+ // Check to see if we are decrypting rather than signature verification
+ Crypto decCrypto = securityProperties.getDecryptionCrypto();
+ if (decCrypto instanceof Merlin && decCrypto != crypto) {
+ return ((Merlin)decCrypto).getPrivateKey(publicKey, callbackHandler);
+ }
+ throw ex;
}
- throw ex;
}
+ return super.getKey(algorithmURI, algorithmUsage, correlationID);
}
@Override
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java?rev=1724016&r1=1724015&r2=1724016&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java Mon Jan 11 12:17:08 2016
@@ -26,6 +26,7 @@ import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import org.apache.wss4j.common.crypto.Crypto;
+import org.apache.wss4j.common.crypto.Merlin;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.common.principal.PublicKeyPrincipalImpl;
import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
@@ -66,18 +67,21 @@ public class RsaKeyValueSecurityTokenImp
@Override
public Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
String correlationID) throws XMLSecurityException {
- PublicKey publicKey = getPublicKey();
-
- try {
- return crypto.getPrivateKey(publicKey, callbackHandler);
- } catch (WSSecurityException ex) {
- // Check to see if we are decrypting rather than signature verification
- Crypto decCrypto = securityProperties.getDecryptionCrypto();
- if (decCrypto != null && decCrypto != crypto) {
- return decCrypto.getPrivateKey(publicKey, callbackHandler);
+ if (crypto instanceof Merlin) {
+ PublicKey publicKey = getPublicKey();
+
+ try {
+ return ((Merlin)crypto).getPrivateKey(publicKey, callbackHandler);
+ } catch (WSSecurityException ex) {
+ // Check to see if we are decrypting rather than signature verification
+ Crypto decCrypto = securityProperties.getDecryptionCrypto();
+ if (decCrypto instanceof Merlin && decCrypto != crypto) {
+ return ((Merlin)decCrypto).getPrivateKey(publicKey, callbackHandler);
+ }
+ throw ex;
}
- throw ex;
}
+ return super.getKey(algorithmURI, algorithmUsage, correlationID);
}
@Override