Author: ruchithf
Date: Tue Aug 29 10:23:34 2006
New Revision: 438121
URL: http://svn.apache.org/viewvc?rev=438121&view=rev
Log:
1.) Fixed the key derivation to use two label values properly
2.) Updated the saml namespace
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/WSConstants.java
webservices/wss4j/trunk/src/org/apache/ws/security/conversation/ConversationConstants.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSConstants.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSConstants.java?rev=438121&r1=438120&r2=438121&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSConstants.java
(original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSConstants.java Tue Aug
29 10:23:34 2006
@@ -41,7 +41,7 @@
public static final String SOAPMESSAGE_NS11 =
"http://docs.oasis-open.org/wss/2004/xx/oasis-2004xx-wss-soap-message-security-1.0";
public static final String USERNAMETOKEN_NS =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0";
public static final String X509TOKEN_NS =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0";
- public static final String SAMLTOKEN_NS =
"http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0";
+ public static final String SAMLTOKEN_NS =
"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0";
/*
* The Element name (local name) of the security header
*/
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/conversation/ConversationConstants.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/conversation/ConversationConstants.java?rev=438121&r1=438120&r2=438121&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/conversation/ConversationConstants.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/conversation/ConversationConstants.java
Tue Aug 29 10:23:34 2006
@@ -21,12 +21,12 @@
*/
public class ConversationConstants {
- private static final String NS_YEAR_PREFIX =
"http://schemas.xmlsoap.org/ws/2005/02/";
+ private static final String NS_YEAR_PREFIX =
"http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512";
/**
- * WS-Secure Conversation namespace
+ * WS-Secure Conversation namespace
*/
- public final static String WSC_NS = NS_YEAR_PREFIX + "sc";
+ public final static String WSC_NS = NS_YEAR_PREFIX;
/**
* TOken type of DerivedKeyToken
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java?rev=438121&r1=438120&r2=438121&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
(original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
Tue Aug 29 10:23:34 2006
@@ -108,7 +108,7 @@
return doc;
}
- protected void prepare(Document doc, WSSecHeader secHeader)
+ public void prepare(Document doc, WSSecHeader secHeader)
throws WSSecurityException {
super.prepare(doc);
@@ -392,6 +392,11 @@
.getElement(), false);
}
+ public void appendSigToHeader(WSSecHeader secHeader) {
+ WSSecurityUtil.appendChildElement(document,
secHeader.getSecurityHeader(), sig
+ .getElement());
+ }
+
/**
* Compute the Signature over the references.
@@ -418,6 +423,8 @@
}
}
+
+
/**
* @see
org.apache.ws.security.message.WSSecDerivedKeyBase#getDerivedKeyLength()
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java?rev=438121&r1=438120&r2=438121&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
Tue Aug 29 10:23:34 2006
@@ -17,10 +17,7 @@
package org.apache.ws.security.message;
-import java.io.UnsupportedEncodingException;
-
import org.apache.ws.security.WSSecurityException;
-import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.conversation.ConversationConstants;
import org.apache.ws.security.conversation.dkalgo.AlgoFactory;
import org.apache.ws.security.conversation.dkalgo.DerivationAlgorithm;
@@ -32,6 +29,8 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import java.io.UnsupportedEncodingException;
+
/**
* Base class for DerivedKey encryption and signature
*
@@ -64,6 +63,15 @@
protected String dktId = null;
+ /**
+ * Client's label value
+ */
+ protected String clientLabel = ConversationConstants.DEFAULT_LABEL;
+
+ /**
+ * Service's label value
+ */
+ protected String serviceLabel = ConversationConstants.DEFAULT_LABEL;
/**
* soap:Envelope element
@@ -127,6 +135,22 @@
}
/**
+ * Set the label value of the client.
+ * @param clientLabel
+ */
+ public void setClientLabel(String clientLabel) {
+ this.clientLabel = clientLabel;
+ }
+
+ /**
+ * Set the label value of the service.
+ * @param serviceLabel
+ */
+ public void setServiceLabel(String serviceLabel) {
+ this.serviceLabel = serviceLabel;
+ }
+
+ /**
* Initialize a WSSec Derived key.
*
* The method prepares and initializes a WSSec dereived key structure
after the
@@ -154,7 +178,7 @@
int length = this.getDerivedKeyLength();
byte[] label;
try {
- label = ConversationConstants.DEFAULT_LABEL.getBytes("UTF-8");
+ label = (clientLabel + serviceLabel).getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new WSSecurityException("UTF-8 encoding is not supported",
e);
}
@@ -206,6 +230,11 @@
public void prependDKElementToHeader(WSSecHeader secHeader) {
WSSecurityUtil.prependChildElement(document, secHeader
.getSecurityHeader(), dkt.getElement(), false);
+ }
+
+ public void appendDKElementToHeader(WSSecHeader secHeader) {
+ WSSecurityUtil.appendChildElement(document, secHeader
+ .getSecurityHeader(), dkt.getElement());
}
}
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java?rev=438121&r1=438120&r2=438121&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
Tue Aug 29 10:23:34 2006
@@ -84,7 +84,8 @@
DerivationAlgorithm algo = AlgoFactory.getInstance(this.algorithm);
byte[] labelBytes = null;
if(label == null || (label != null && label.length() == 0)) {
- labelBytes =
ConversationConstants.DEFAULT_LABEL.getBytes("UTF-8");
+ labelBytes = (ConversationConstants.DEFAULT_LABEL +
ConversationConstants.DEFAULT_LABEL)
+ .getBytes("UTF-8");
} else {
labelBytes = this.label.getBytes("UTF-8");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]