[WSS4J] wss4j/src/org/apache/ws/security/message WSSignEnvelope.java,1.28,1.29

[email protected] Mon, 09 Feb 2004 08:10:31 -0800
Newsgroups gmane.text.xml.wss4j
Message-ID <[email protected]>
Update of /cvsroot/wss4j/wss4j/src/org/apache/ws/security/message
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8146/src/org/apache/ws/security/message

Modified Files:
	WSSignEnvelope.java 
Log Message:
Add some more hooks for STRTransform. In particular a way to
exchange/publish some more information about the document and its
environment as it is processed during signature and verfication.
These hooks are working, but there is only a dummy STRTransform only.

Index: WSSignEnvelope.java
===================================================================
RCS file: /cvsroot/wss4j/wss4j/src/org/apache/ws/security/message/WSSignEnvelope.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- WSSignEnvelope.java	5 Feb 2004 18:55:06 -0000	1.28
+++ WSSignEnvelope.java	9 Feb 2004 16:10:28 -0000	1.29
@@ -60,6 +60,8 @@
 import org.apache.ws.security.SOAPConstants;
 import org.apache.ws.security.WSEncryptionPart;
 import org.apache.ws.security.WSSecurityException;
+import org.apache.ws.security.WSDocInfo;
+import org.apache.ws.security.WSDocInfoStore;
 import org.apache.ws.security.transform.STRTransform;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.message.token.BinarySecurity;
@@ -176,6 +178,14 @@
 			log.debug("Beginning signing...");
 		} 
 
+		/*
+		 * Gather some info about the document to process and store
+		 * it for retrival
+		 */
+		WSDocInfo wsDocInfo = new WSDocInfo(doc.hashCode());
+		wsDocInfo.setCrypto(crypto);
+		WSDocInfoStore.store(wsDocInfo);
+		
 		Element envelope = doc.getDocumentElement();
 		SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants(envelope);			
 		
@@ -233,7 +243,7 @@
 	 	 * 			points to the security token or the token itself. If 
 	 	 * 			its a direct reference sign the token, otherwise sign
 	 	 * 			the KeyInfo Element.
-	 	 * "STRTransform": Setup the de:Reference to use STR Transform
+	 	 * "STRTransform": Setup the ds:Reference to use STR Transform
 	 	 * 
 	 	 */			
 			if (elemName.equals("Token")) {
@@ -247,7 +257,7 @@
 				}
 			}
 			else if (elemName.equals("STRTransform")) {
-				Element ctx = null;
+				Element ctx = null;	// This element shall conatin the arg to STR
 				transforms = new Transforms(doc);
 				transforms.addTransform(STRTransform.implementedTransformURI /*, ctx */);
 				sig.addDocument("#" + keyInfoUri, transforms);
@@ -266,7 +276,6 @@
 			}
 		}
  
-		// remove according to comment of xml-security mailing list
         sig.addResourceResolver(EnvelopeIdResolver.getInstance());
         
         WSSecurityUtil.prependChildElement(doc, securityHeader, sig.getElement(), false);
@@ -288,6 +297,7 @@
             }
             token.setID(certUri);
             WSSecurityUtil.prependChildElement(doc, securityHeader, token.getElement(), false);
+            wsDocInfo.setBst(token.getElement());
         } else if (keyIdentifierType == WSConstants.ISSUER_SERIAL) {
             XMLX509IssuerSerial data = new XMLX509IssuerSerial(doc,
                     certs[0].getIssuerDN().getName(),
@@ -311,7 +321,10 @@
 			" set transform= " + (t2-t1) +
 			" sec-ref= " + (t3-t2) +
 			" signature= " + (t4-t3));
-		}        
+		}
+		
+		WSDocInfoStore.delete(wsDocInfo);        
+
         if (doDebug) {
         	log.debug("Signing complete.");
         } 



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn