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 2013/10/17 18:07:17 UTC

svn commit: r1533129 - /webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java

Author: coheigea
Date: Thu Oct 17 16:07:17 2013
New Revision: 1533129

URL: http://svn.apache.org/r1533129
Log:
Fixing how keys are returned from a SecurityContextToken

Modified:
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java?rev=1533129&r1=1533128&r2=1533129&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java Thu Oct 17 16:07:17 2013
@@ -21,15 +21,14 @@ package org.apache.wss4j.stax.validate;
 import org.apache.wss4j.binding.wssc.AbstractSecurityContextTokenType;
 import org.apache.wss4j.common.ext.WSPasswordCallback;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.common.util.KeyUtils;
 import org.apache.wss4j.stax.ext.WSSUtils;
 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.apache.xml.security.stax.impl.securityToken.AbstractInboundSecurityToken;
 import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
 
-import javax.crypto.spec.SecretKeySpec;
 import java.security.Key;
 
 public class SecurityContextTokenValidatorImpl implements SecurityContextTokenValidator {
@@ -57,7 +56,6 @@ public class SecurityContextTokenValidat
                     return key;
                 }
 
-                String algo = JCEAlgorithmMapper.translateURItoJCEID(algorithmURI);
                 WSPasswordCallback passwordCallback = new WSPasswordCallback(
                         identifier, WSPasswordCallback.Usage.SECURITY_CONTEXT_TOKEN);
                 WSSUtils.doSecretKeyCallback(
@@ -66,7 +64,7 @@ public class SecurityContextTokenValidat
                     throw new WSSecurityException(WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE,
                             "noKey", securityContextTokenType.getId());
                 }
-                key = new SecretKeySpec(passwordCallback.getKey(), algo);
+                key = KeyUtils.prepareSecretKey(algorithmURI, passwordCallback.getKey());
                 setSecretKey(algorithmURI, key);
                 return key;
             }