FileDocCategorySizeDatePackage
AsymmetricBindingProcessor.javaAPI DocExample7584Thu Jul 19 02:00:10 BST 2007com.sun.xml.ws.security.impl.policyconv

AsymmetricBindingProcessor

public class AsymmetricBindingProcessor extends BindingProcessor
author
K.Venugopal@sun.com

Fields Summary
private com.sun.xml.ws.security.policy.AsymmetricBinding
binding
Constructors Summary
public AsymmetricBindingProcessor(com.sun.xml.ws.security.policy.AsymmetricBinding asBinding, XWSSPolicyContainer container, boolean isServer, boolean isIncoming, Vector signedParts, Vector encryptedParts, Vector signedElements, Vector encryptedElements)
Creates a new instance of AsymmetricBindingProcessor

    
           
       
                
               
        this.binding = asBinding;
        this.container = container;
        this.isServer = isServer;
        this.isIncoming = isIncoming;
        protectionOrder = binding.getProtectionOrder();
        tokenProcessor = new TokenProcessor(isServer,isIncoming,pid);
        iAP = new IntegrityAssertionProcessor(binding.getAlgorithmSuite(),binding.isSignContent());
        eAP = new EncryptionAssertionProcessor(binding.getAlgorithmSuite(),false);
        this.signedParts = signedParts;
        this.signedElements = signedElements;
        this.encryptedElements = encryptedElements;
        this.encryptedParts = encryptedParts;
    
Methods Summary
protected voidclose()

        
        if(protectionOrder == Binding.SIGN_ENCRYPT){
            container.insert(primaryEP);
        }
    
protected com.sun.xml.ws.security.policy.BindinggetBinding()

        return binding;
    
protected com.sun.xml.ws.security.policy.TokengetEncryptionToken()

        if((isServer && !isIncoming) || (!isServer && isIncoming)){
            return binding.getInitiatorToken();
        }else{
            return binding.getRecipientToken();
        }
    
protected com.sun.xml.wss.impl.policy.mls.EncryptionPolicygetSecondaryEncryptionPolicy()

        if(sEncPolicy == null){
            sEncPolicy  = new EncryptionPolicy();
            sEncPolicy.setUUID(pid.generateID());
            Token token = null;
            token = getEncryptionToken();
            tokenProcessor.addKeyBinding(sEncPolicy,token,false);
            container.insert(sEncPolicy);
        }
        return sEncPolicy;
    
protected com.sun.xml.ws.security.policy.TokengetSignatureToken()

        if((isServer && !isIncoming) || (!isServer && isIncoming)){
            return binding.getRecipientToken();
        }else{
            return binding.getInitiatorToken();
        }
    
public voidprocess()

        Token st = getSignatureToken();
        Token et = getEncryptionToken();
        if(st != null){
            primarySP = new SignaturePolicy();
            primarySP.setUUID(pid.generateID());
            if(logger.isLoggable(Level.FINEST)){
                logger.log(Level.FINEST,"ID of Primary signature policy is "+primarySP.getUUID());
            }
            tokenProcessor.addKeyBinding(primarySP,st,true);
            SignaturePolicy.FeatureBinding spFB = (com.sun.xml.wss.impl.policy.mls.SignaturePolicy.FeatureBinding)
                    primarySP.getFeatureBinding();
            //spFB.setCanonicalizationAlgorithm(CanonicalizationMethod.EXCLUSIVE);
            SecurityPolicyUtil.setCanonicalizationMethod(spFB, binding.getAlgorithmSuite());
            spFB.isPrimarySignature(true);
        }
        if(et != null){
            primaryEP = new EncryptionPolicy();
            primaryEP.setUUID(pid.generateID());
            tokenProcessor.addKeyBinding(primaryEP,et,false);
            if(logger.isLoggable(Level.FINEST)){
                logger.log(Level.FINEST,"ID of Encryption policy is "+primaryEP.getUUID());
            }
        }
        if(protectionOrder == Binding.SIGN_ENCRYPT){
            container.insert(primarySP);
        }else{
            container.insert(primaryEP);
            container.insert(primarySP);
            
        }
        addPrimaryTargets();
        if(foundEncryptTargets && binding.getSignatureProtection()){
            if(logger.isLoggable(Level.FINEST)){
                logger.log(Level.FINEST,"PrimarySignature will be Encrypted");
            }
            protectPrimarySignature();
        }
        if(binding.isIncludeTimeStamp()){
            if(logger.isLoggable(Level.FINEST)){
                logger.log(Level.FINEST,"Timestamp header will be added to the message and will be Integrity protected ");
            }
            protectTimestamp();
        }
        if(binding.getTokenProtection()){
            if(logger.isLoggable(Level.FINEST)){
                logger.log(Level.FINEST,"Token reference by primary signature with ID "+primarySP.getUUID()+" will be Integrity protected");
            }
            protectToken((WSSPolicy) primarySP.getKeyBinding());
        }