You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by mu...@apache.org on 2004/08/12 12:36:45 UTC

cvs commit: ws-fx/wss4j/src/org/apache/ws/axis/security/conversation ConversationServerHandler.java

muthulee    2004/08/12 03:36:45

  Modified:    wss4j/src/org/apache/ws/axis/security/conversation
                        ConversationServerHandler.java
  Log:
  Performs serverside operations needed to perform secure conversation for Axis
  
  Revision  Changes    Path
  1.8       +420 -204  ws-fx/wss4j/src/org/apache/ws/axis/security/conversation/ConversationServerHandler.java
  
  Index: ConversationServerHandler.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/wss4j/src/org/apache/ws/axis/security/conversation/ConversationServerHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConversationServerHandler.java	9 Aug 2004 17:53:41 -0000	1.7
  +++ ConversationServerHandler.java	12 Aug 2004 10:36:45 -0000	1.8
  @@ -17,65 +17,86 @@
   
   package org.apache.ws.axis.security.conversation;
   
  +import java.io.ByteArrayOutputStream;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.Stack;
  +import java.util.Vector;
  +
  +import javax.xml.soap.SOAPHeader;
  +import javax.xml.soap.SOAPHeaderElement;
  +
   import org.apache.axis.AxisFault;
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.SOAPPart;
   import org.apache.axis.handlers.BasicHandler;
  -import org.apache.ws.axis.security.WSDoAllConstants;
  -import org.apache.ws.axis.security.WSDoAllSender;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.apache.ws.security.SOAPConstants;
   import org.apache.ws.security.WSConstants;
  +import org.apache.ws.security.WSEncryptionPart;
   import org.apache.ws.security.WSSConfig;
  -import org.apache.ws.security.WSSecurityEngine;
  -import org.apache.ws.security.WSSecurityException;
  -import org.apache.ws.security.components.crypto.Crypto;
  -import org.apache.ws.security.components.crypto.CryptoFactory;
  +
  +import org.apache.ws.security.conversation.ConvEngineResult;
  +import org.apache.ws.security.conversation.ConversationConstants;
  +import org.apache.ws.security.conversation.ConversationEngine;
   import org.apache.ws.security.conversation.ConversationException;
   import org.apache.ws.security.conversation.ConversationManager;
   import org.apache.ws.security.conversation.ConversationUtil;
   import org.apache.ws.security.conversation.DerivedKeyCallbackHandler;
  -import org.apache.ws.security.conversation.message.token.DerivedKeyToken;
  -import org.apache.ws.security.conversation.message.token.RequestSecurityTokenResponse;
  +import org.apache.ws.security.conversation.message.info.DerivedKeyInfo;
   import org.apache.ws.security.conversation.message.token.SecurityContextToken;
  -import org.apache.ws.security.message.token.Reference;
   import org.apache.ws.security.message.token.SecurityTokenReference;
  -import org.apache.ws.security.trust.TrustConstants;
  +import org.apache.ws.security.util.StringUtil;
   import org.apache.ws.security.util.WSSecurityUtil;
   import org.apache.xml.security.utils.XMLUtils;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  -import javax.xml.soap.SOAPException;
  -import javax.xml.soap.SOAPHeader;
  -import javax.xml.soap.SOAPHeaderElement;
  -import java.io.ByteArrayOutputStream;
  -import java.util.Iterator;
  -
   /**
    * Serverside handler that implements WS-Secure Conversation for Axis.
    *
  - * @author Dimuthu
  - *         <p/>
  - *         Each application has a set of policies on how it should be accessed.
  - *         This handler facilitates one of the following two types of base tokens for a service
  - *         1) username token.
  - *         2) X509 certificates.
  + *
  + * @author Dimuthu Leealarthne. (muthulee@yahoo.com)
  + * 
    */
   public class ConversationServerHandler extends BasicHandler {
  -
  -    private static DerivedKeyCallbackHandler dkcbHandler;
  -
  -    /**
  -     * Contains the set of SecurityContextTokens of clients that access the service at this moment.
  -     */
  +    private static Log log =
  +        LogFactory.getLog(ConversationServerHandler.class.getName());
  +    private boolean doDebug = false;
  +
  +    private static DerivedKeyCallbackHandler dkcbHandler =
  +        new DerivedKeyCallbackHandler();
  +
  +    private static boolean isConfigured = false;
  +    private SOAPConstants soapConstants = null;
  +	
  +	private HashMap configurator = new HashMap();
  +    
  +    private int[] actionsInt = null;       
  +    
  +    private boolean isSessionInfoConfigured = false;
  +    
       public ConversationServerHandler() {
  -        System.out.println("ConversationServerHandler :: created");
  -        dkcbHandler = new DerivedKeyCallbackHandler();
  +        log.debug("ConversationServerHandler :: created");
  +    }
  +    
  +    static{
  +		org.apache.xml.security.Init.init();
  +
       }
   
  +	/**
  +	 * Method inherited from the BasicHandler.
  +	 * If in the request flow calls the doRequestMetod()
  +	 * else calls the doResponse() method. 
  +	 * 
  +	 */ 
       public void invoke(MessageContext msg) throws AxisFault {
  -        System.out.println("ConversationServerHandler :: invoked");
  +        log.debug("ConversationServerHandler :: invoked");
  +      
           if (msg.getPastPivot())
               doResponse(msg);
           else
  @@ -83,211 +104,406 @@
       }
   
       /**
  -     * Method looks for a SCT in the SOAP envelope,
  -     * <li>        Case 1 :: if it is available then this is the first round.<\li>
  -     * <li>        Case 2 :: if it is not available check for derived keys<\li>
  -     * <p/>
  -     * Case 1 :: Creating a new conversation session and add it to the <code>DerivedKeyCallBackHandler</code>
  -     * <p/>
  -     * Case 2 :: Then call a method <></code> derived key decryption.
  -     *
  -     * @param msg
  +     * Called in the request flow of the request.
  +     * Method looks for a SecurityToken in the SOAP envelope.
  +     * Process the header.
  +     * 
  +     *  @param msg
        * @throws AxisFault
        */
       private void doRequest(MessageContext msg) throws AxisFault {
  +    	if(!isSessionInfoConfigured){
  +    		initSessionInfo();
  +    		isSessionInfoConfigured = true;
  +    	}
  +    		
  +        Document doc = null;
  +        Message message = msg.getCurrentMessage();
  +        
  +        Boolean verify_trust = new Boolean((String)getOption(ConvHandlerConstants.VERIFY_TRUST));
  +        
  +        if(verify_trust.booleanValue()==true){
  +			String trustPropFile = (String)getOption(ConvHandlerConstants.TRUST_ENGINE_PROP);
  +          
  +        }
  +        
   
  +        // Get the soap message as a Docuemnt
  +        SOAPPart sPart = (org.apache.axis.SOAPPart) message.getSOAPPart();
           try {
  -            Document doc = null;
  -            Message message = msg.getCurrentMessage();
  -            RequestSecurityTokenResponse stRes;
  -
  -            // Code to get the soap message as a Docuemnt
  -            SOAPPart sPart = (org.apache.axis.SOAPPart) message.getSOAPPart();
               doc =
  -                    ((org.apache.axis.message.SOAPEnvelope) sPart.getEnvelope())
  +                ((org.apache.axis.message.SOAPEnvelope) sPart.getEnvelope())
                       .getAsDocument();
  +        } catch (Exception e) {
  +            e.printStackTrace();
  +        }
  +		
  +		if((this.configurator = (HashMap)msg.getProperty("PolicyObject"))==null){
  +			log.debug("ConversationServerHandler :: I am configuring");
  +		       initSessionInfo(); // load values to this.configurator from wsdd
  +		}
  +		
  +		soapConstants = WSSecurityUtil.getSOAPConstants(doc.getDocumentElement());
  +        ConversationEngine eng = new ConversationEngine(this.configurator);
  +         
  +        try {
  +        	//TODO :: Process results and fix the scratch
  +            Vector results = eng.processSecConvHeader(doc, "", dkcbHandler);
  +			ConvEngineResult convResult  = null;
  +			String uuid = "";
  +			
  +			/*put the actions into a stack to obtain LIFO behavior
  +			 * Rational for using the stack;
  +			 * 
  +			 * Consider "Signature Encrypt" 
  +			 * Then the ConvEngine Results will be in the order "Encrypt Signature"
  +			 * i.e. ConvEngine reusult containing ConvEngineResult.ENCRYPT_DERIVED_KEY
  +			 * will be before ConvEngineResult.SIGN_DERIVED_KEY
  +			 * 
  +			 * Hense I need to read actions in the order of Last in First out - the stack 
  +			 * 
  +			 * This is same for "Encrypt Signature" visa versa.
  +			 */
  +			Stack stk = new Stack();
  +			for(int i=0; i<actionsInt.length ; i++){
  +			    stk.push(new Integer(actionsInt[i]));
  +			}
  +			int act = -1;
  +			boolean rstr = false;
  +			for(int i=0; i<results.size(); i++){
  +				convResult=(ConvEngineResult)results.get(i);
  +				
  +				switch(convResult.getAction()){
  +				
  +				case ConvEngineResult.SECURITY_TOKEN_RESPONSE :
  +				log.debug("ConversationServerHandler :: Found RSTR result");
  +				uuid = convResult.getUuid();
  +				rstr = true;
  +				break;
  +				
  +				case ConvEngineResult.ENCRYPT_DERIVED_KEY :
  +				log.debug("ConversationServerHandler :: Found dk_encrypt result"); 				
  +				    if(stk.isEmpty()){
  +				    	throw new AxisFault("Action mismatch");
  +				    }
  +				    
  +				    act =((Integer)stk.pop()).intValue();
  +				    if(act == ConversationConstants.DK_ENCRYPT){
  +				    	//fine do nothing
  +				    }else{
  +				    	throw new AxisFault("Mismatch action order");
  +				    }
  +				break;
  +				
  +				case ConvEngineResult.SIGN_DERIVED_KEY :
  +				log.debug("ConversationServerHandler :: Found dk_sign result");
  +					if(stk.isEmpty()){
  +						throw new AxisFault("Action mismatch");
  +					}
  +					act =((Integer)stk.pop()).intValue();
  +					if(act == ConversationConstants.DK_SIGN){
  +					    //fine do nothing
  +					}else{
  +						throw new AxisFault("Mismatch action order");
  +					}
  +				break;
  +				
  +				case ConvEngineResult.SCT :
  +				log.debug("ConversationServerHandler :: Found SCT result");
  +				uuid = convResult.getUuid();
  +				break;
  +				
  +				}
  +				}
  +			
  +			if(uuid.equals("")){
  +				throw new AxisFault("ConversationServerHandler :: Cannot find Session.");
  +			}
  +		    
  +		    if(!rstr){
  +		    if(!stk.isEmpty()){
  +			  throw new AxisFault("Action mismatch. Required action missing");
  +			}
  +            }
  +			msg.setProperty(ConversationConstants.IDENTIFIER,uuid);
  +        
  +        
  +        
  +//        NodeList ndlist = doc.getElementsByTagNameNS(ConversationConstants.WSC_NS,"SecurityContextToken");
  +//        
  +//       try {
  +//             SecurityContextToken sct = new SecurityContextToken((Element)ndlist.item(0));
  +//		msg.setProperty(ConversationConstants.IDENTIFIER,uuid);
  +//        } catch (WSSecurityException e2) {
  +//            // TODO Auto-generated catch block
  +//            e2.printStackTrace();
  +//        }
  +        
  +        
  +        } catch (ConversationException e1) {
  +            e1.printStackTrace();
  +            throw new AxisFault("CovnersationServerHandler :: "+e1.getMessage());
  +        }
   
  -            //Now search for a SCT in the Security header.        
  -            NodeList list =
  -                    doc.getElementsByTagNameNS(WSConstants.WSSE_NS,
  -                            TrustConstants.SECURITY_CONTEXT_TOKEN_RESPONSE_LN);
  -            int len = list.getLength();
  -            if (len == 0) { // No SCT is found
  -                //    TODO:: Look for derived keys and do the decryption
  -                try {
  -                    NodeList ndList =
  -                            doc.getElementsByTagNameNS(WSConstants.WSSE_NS,
  -                                    "DerivedKeyToken");
  -                    Element tmpE;
  -                    DerivedKeyToken tmpDKT;
  -                    String tmpID;
  -                    for (int i = 0; i < ndList.getLength(); i++) {
  -                        tmpE = (Element) ndList.item(i);
  -                        tmpDKT = new DerivedKeyToken(tmpE);
  -                        tmpID = tmpDKT.getID();
  -                        //Add to the conv Session .... :-)                            
  -                    }
  -                    WSSecurityEngine secEng = new WSSecurityEngine();
  -                    secEng.processSecurityHeader(doc,
  -                            "",
  -                            dkcbHandler,
  -                            null);
  -
  -                } catch (WSSecurityException e1) {
  -                    e1.printStackTrace();
  -                    throw new AxisFault("Error !!!! " + e1.getMessage());
  -                }
  -
  -            } else {
  -
  -                Element elem = (Element) list.item(0);
  -                stRes = new RequestSecurityTokenResponse(elem);
  -
  -                System.out.println("SecurityTokenResponse Found :: " + stRes.toString());
  -
  -                // get securityContextToken, requestedProofToken
  -//                SecurityContextToken SCT =
  -//                    stRes.getRequestedSecurityToken().getSecurityContextToken();
  -//                RequestedProofToken proofToken = stRes.getRequestedProfToken();
  -
  -                //TODO:: romove the hard coded decryption
  -//                proofToken.doDecryption(
  -//                    "org.apache.ws.axis.oasis.PWCallback",
  -//                    loadEncryptionCrypto());
  -
  -//                SecurityContextInfo scInfo =
  -//                    new SecurityContextInfo(SCT, proofToken, 1);
  -                //scInfo.setSharedSecret(proofToken.getSharedSecret());
  -//                dkcbHandler.addSecurtiyContext("uuid:secureZone", scInfo);
  -//
  -//                //Set the stuff in msgContext.
  -//                msg.setProperty("WSSecureConversation.ID", SCT.getIdentifier());
  +        // Replace sPart with the new sPart.
  +        ByteArrayOutputStream os = new ByteArrayOutputStream();
  +        XMLUtils.outputDOM(doc, os, true);
  +        String osStr = os.toString();
  +        sPart.setCurrentMessage(osStr, SOAPPart.FORM_STRING);
   
  -            }
  -            // Replace sPart with the new sPart.
  -            ByteArrayOutputStream os = new ByteArrayOutputStream();
  -            XMLUtils.outputDOM(doc, os, true);
  -            String osStr = os.toString();
  -            sPart.setCurrentMessage(osStr, SOAPPart.FORM_STRING);
  -
  -            //Following sets the headers as processed.
  -            SOAPHeader sHeader = null;
  -            try {
  -                sHeader = message.getSOAPEnvelope().getHeader();
  -            } catch (Exception ex) {
  -                throw new AxisFault("WSDoAllReceiver: cannot get SOAP header after security processing",
  -                        ex);
  -            }
  -            String actor = null;
  -            Iterator headers = sHeader.examineHeaderElements(actor);
  +        //Following sets the headers as processed.
  +        SOAPHeader sHeader = null;
  +        try {
  +            sHeader = message.getSOAPEnvelope().getHeader();
  +        } catch (Exception ex) {
  +            throw new AxisFault(
  +                "ConversatonServerHandler: cannot get SOAP header after security processing",
  +                ex);
  +        }
  +        String actor = null;
  +        Iterator headers = sHeader.examineHeaderElements(actor);
   
  -            SOAPHeaderElement headerElement = null;
  -            while (headers.hasNext()) {
  -                SOAPHeaderElement hE = (SOAPHeaderElement) headers.next();
  -                if (hE.getLocalName().equals(WSConstants.WSSE_LN)
  -                        && hE.getNamespaceURI().equals(WSConstants.WSSE_NS)) {
  -                    headerElement = hE;
  -                    break;
  -                }
  +        SOAPHeaderElement headerElement = null;
  +        while (headers.hasNext()) {
  +            SOAPHeaderElement hE = (SOAPHeaderElement) headers.next();
  +            if (hE.getLocalName().equals(WSConstants.WSSE_LN)
  +                && hE.getNamespaceURI().equals(WSConstants.WSSE_NS)) {
  +                headerElement = hE;
  +                break;
               }
  +        }
  +        (
               (
  -                    (
  -                    org
  +                org
                       .apache
                       .axis
                       .message
                       .SOAPHeaderElement) headerElement)
  -                    .setProcessed(true);
  -        } catch (AxisFault e) {
  -            e.printStackTrace();
  -        } catch (WSSecurityException e) {
  -            e.printStackTrace();
  -        } catch (SOAPException e) {
  -            e.printStackTrace();
  -        } catch (Exception e) {
  -            e.printStackTrace();
  -        }
  +                    .setProcessed(
  +            true);
   
       } //do request
   
  +	  /**
  +		* This method is called in the response. 
  +		* This method should
  +		* 1) Add derived keys to the message as required.
  +		* 2) Sign/encrypt as required.
  +		*
  +		* @param msgContext
  +		* @throws AxisFault
  +		*/
       private void doResponse(MessageContext msg) throws AxisFault {
  -
  -        System.out.println("Doing response .... ");
  +		
  +		if(!isSessionInfoConfigured){
  +			initSessionInfo();
  +			isSessionInfoConfigured = true;
  +		}
  +		
  +		//System.out.println("Doing response .... ");
           Document doc = null;
           Message message = msg.getCurrentMessage();
           String uuid, identifier;
  -        //    Code to get the soap message as a Docuemnt
  +        //	Code to get the soap message as a Docuemnt
           SOAPPart sPart = (org.apache.axis.SOAPPart) message.getSOAPPart();
  -        try {
   
  +        try {
               doc =
  -                    ((org.apache.axis.message.SOAPEnvelope) sPart.getEnvelope())
  +                ((org.apache.axis.message.SOAPEnvelope) sPart.getEnvelope())
                       .getAsDocument();
  -
  -            //get the uuid
  -            uuid = (String) msg.getProperty("WSSecureConversation.ID");
  -
  -            // Derrive the token 
  -            ConversationManager manager = new ConversationManager();
  -            String genID = ConversationUtil.genericID();
  -            // manager.addDerivedKeyToken(doc, uuid, dkcbHandler, genID);
  -
  -            //add the relavent SCT
  -            Element securityHeader =
  -                    WSSecurityUtil.findWsseSecurityHeaderBlock(WSSConfig.getDefaultWSConfig(),
  -                            doc,
  -                            doc.getDocumentElement(),
  -                            false);
  -            WSSecurityUtil.appendChildElement(doc,
  -                    securityHeader,
  -                    (new SecurityContextToken(doc, uuid)).getElement());
  -
  -            org.apache.xml.security.Init.init();
  -
  -            //set it as current message
  -            ByteArrayOutputStream os = new ByteArrayOutputStream();
  -            XMLUtils.outputDOM(doc, os, true);
  -            String osStr = os.toString();
  -            sPart.setCurrentMessage(osStr, SOAPPart.FORM_STRING);
  -
  -            //Creating wsse:Reference
  -            Reference ref = new Reference(WSSConfig.getDefaultWSConfig(), doc);
  -            ref.setURI("#" + genID);
  -            ref.setValueType("DerivedKeyToken");
  -            SecurityTokenReference stRef = new SecurityTokenReference(WSSConfig.getDefaultWSConfig(), doc);
  -            stRef.setReference(ref);
  -
  -            //set mesage properties
  -            msg.setProperty(WSDoAllConstants.ENC_PROP_FILE,
  -                    "crypto.properties");
  -            msg.setProperty(WSDoAllConstants.ENC_KEY_ID, "EmbeddedKeyName");
  -            msg.setProperty(WSDoAllConstants.ENC_KEY_NAME, stRef.toString());
  -            msg.setUsername(ConversationUtil.generateIdentifier(uuid, genID));
  -            msg.setProperty(WSDoAllConstants.ENC_CALLBACK_REF,
  -                    dkcbHandler);
  -            msg.setProperty(WSDoAllConstants.ACTION, "Encrypt");
  -
  -            WSDoAllSender wsd = new WSDoAllSender();
  -            wsd.invoke(msg);
  -        } catch (AxisFault e) {
  -            e.printStackTrace();
  -        } catch (SOAPException e) {
  -            e.printStackTrace();
  -        } catch (ConversationException e) {
  -            e.printStackTrace();
           } catch (Exception e) {
               e.printStackTrace();
  +            throw new AxisFault("CovnersationServerHandler :: "+e.getMessage());
           }
   
  -    } //doResponse
  +        //get the uuid
  +        uuid = (String) msg.getProperty(ConversationConstants.IDENTIFIER);
  +        
  +        if (uuid == null) {
  +        	//TODO :: throw exception
  +            System.out.println("UUID NULl line :: 221");
  +        }
  +        
  +  
  +		try {
  +
  +			  //add the relavent SCT
  +			  Element securityHeader =
  +				  WSSecurityUtil.findWsseSecurityHeaderBlock(WSSConfig.getDefaultWSConfig(),
  +					  doc,
  +					  doc.getDocumentElement(),
  +					  true);
  +			  WSSecurityUtil.appendChildElement(
  +				  doc,
  +				  securityHeader,
  +				  (new SecurityContextToken(doc, uuid)).getElement());
  +			  ConversationManager manager = new ConversationManager();
  +			  
  +			  for (int i = 0; i < this.actionsInt.length; i++) {
  +				  // Derrive the token
  +				  DerivedKeyInfo dkInfo =
  +					  manager.addDerivedKeyToken(doc, uuid, dkcbHandler);
  +
  +				  String genID = dkInfo.getId();
  +				  SecurityTokenReference stRef =
  +					  dkInfo.getSecTokRef2DkToken();
  +				  if (actionsInt[i] == ConversationConstants.DK_ENCRYPT) {
  +					  manager.performDK_ENCR(
  +						  ConversationUtil.generateIdentifier(uuid, genID),
  +						  "",
  +						  true,
  +						  doc,
  +						  stRef,
  +						  dkcbHandler);
  +				  } else if(actionsInt[i]==ConversationConstants.DK_SIGN){
  +					  manager.performDK_Sign(doc, dkcbHandler, uuid, dkInfo);
  +				  }
  +
  +			  }
  +		  } catch (ConversationException e1) {
  +			  e1.printStackTrace();
  +			  throw new AxisFault(
  +				  "ConversationClientHandler ::" + e1.getMessage());
  +		  }
  +
  +		  //set it as current message
  +		  ByteArrayOutputStream os = new ByteArrayOutputStream();
  +		  XMLUtils.outputDOM(doc, os, true);
  +		  String osStr = os.toString();
  +		  sPart.setCurrentMessage(osStr, SOAPPart.FORM_STRING);
   
  -    //TODO :: Remove this. Temporary method.
  -    private Crypto loadEncryptionCrypto() throws AxisFault {
  -        Crypto crypto = null;
  -        String encPropFile = "crypto.properties";
   
  -        crypto = CryptoFactory.getInstance(encPropFile);
  -        return crypto;
  -    }
  +    } //doResponse
  +
  +/**
  + * Conversation parameters are read from the wsdd file.
  + * When WS-Policy is implemented, these parameters should be 
  + * configurable using policy components.
  + * 
  + * @throws AxisFault
  + */
  + /**
  + * Reads configeration parameters from the wsdd file.
  + * @throws AxisFault
  + */
  +private void initSessionInfo() throws AxisFault {
  +	/**
  +	 * Default values for a session. These will be overriden by WSDD file parameters.
  +	 */
  +	this.configurator = new HashMap();
  +	String tmpStr;
  +	if ((tmpStr = (String) getOption(ConvHandlerConstants.KEY_FREQ))
  +		!= null) {
  +		log.debug("Key Frequency is set ::" + tmpStr);
  +		this.configurator.put(
  +			ConvHandlerConstants.KEY_FREQ,
  +			new Integer(tmpStr));
  +	}
  +
  +	if ((tmpStr = (String) getOption(ConvHandlerConstants.DK_ACTION))
  +		!= null) {
  +		log.debug("Derived Key Action is read ::" + tmpStr);
  +		String[] action = StringUtil.split(tmpStr, ' ');
  +		actionsInt = new int[action.length];
  +
  +		for (int i = 0; i < action.length; i++) {
  +			if ((action[i]).equalsIgnoreCase("Signature")) {
  +				actionsInt[i] = ConversationConstants.DK_SIGN;
  +			} else if ((action[i]).equalsIgnoreCase("Encrypt")) {
  +				actionsInt[i] = ConversationConstants.DK_ENCRYPT;
  +			}
  +		}
  +
  +	}
  +	if ((tmpStr =
  +		(String) getOption(ConvHandlerConstants.USE_FIXED_KEYLEN))
  +		!= null) {
  +		log.debug("Boolean FixedKeyLegnth is set ::" + tmpStr);
  +
  +		Boolean fixed = new Boolean(tmpStr);
  +		this.configurator.put(ConvHandlerConstants.USE_FIXED_KEYLEN, fixed);
  +
  +		if (fixed.booleanValue()) {
  +			//Following has to be specified.
  +			if ((tmpStr =
  +				(String) getOption(ConvHandlerConstants.KEY_LEGNTH))
  +				!= null) {
  +
  +				log.debug("Key Frequency is set ::" + tmpStr);
  +				this.configurator.put(
  +					ConvHandlerConstants.KEY_LEGNTH,
  +					new Long(tmpStr));
  +
  +			} else {
  +				throw new AxisFault("If fixed keys are set then set the key legnth too.");
  +			}
  +
  +		} else {
  +			// TODO :: add all the "MUST" parameters for variable keys
  +		}
  +	}
  +
  +}
  + 
  +    
  +    /**
  +     * Extracted from the class <code>org.apache.ws.axis.security.WSDoAllSender.java</code>.
  +     * 
  +     * @param tmpS
  +     * @param encryptParts
  +     * @throws AxisFault
  +     */
  +	private void splitEncParts(String tmpS, Vector encryptParts)
  +			throws AxisFault {
  +				
  +			WSEncryptionPart encPart = null;
  +			String[] rawParts = StringUtil.split(tmpS, ';');
  +
  +			for (int i = 0; i < rawParts.length; i++) {
  +				String[] partDef = StringUtil.split(rawParts[i], '}');
  +
  +				if (partDef.length == 1) {
  +					if (doDebug) {
  +						log.debug("single partDef: '" + partDef[0] + "'");
  +					}
  +					encPart =
  +						new WSEncryptionPart(
  +							partDef[0].trim(),
  +							soapConstants.getEnvelopeURI(),
  +							"Content");
  +				} else if (partDef.length == 3) {
  +					String mode = partDef[0].trim();
  +					if (mode.length() <= 1) {
  +						mode = "Content";
  +					} else {
  +						mode = mode.substring(1);
  +					}
  +					String nmSpace = partDef[1].trim();
  +					if (nmSpace.length() <= 1) {
  +						nmSpace = soapConstants.getEnvelopeURI();
  +					} else {
  +						nmSpace = nmSpace.substring(1);
  +					}
  +					String element = partDef[2].trim();
  +					if (doDebug) {
  +						log.debug(
  +							"partDefs: '"
  +								+ mode
  +								+ "' ,'"
  +								+ nmSpace
  +								+ "' ,'"
  +								+ element
  +								+ "'");
  +					}
  +					encPart = new WSEncryptionPart(element, nmSpace, mode);
  +				} else {
  +					throw new AxisFault(
  +						"WSDoAllSender: wrong part definition: " + tmpS);
  +				}
  +				encryptParts.add(encPart);
  +			}
  +		}
  +    
  +    
   
   }