Examples of ReferenceList


Examples of com.sun.xml.security.core.xenc.ReferenceList

        KeyInfoStrategy keyInfoStrategy =  null;
        String symmetricKeyName = null;
        AuthenticationTokenPolicy.X509CertificateBinding certificateBinding = null;
        ((NamespaceContextEx)context.getNamespaceContext()).addEncryptionNS();
        ((NamespaceContextEx)context.getNamespaceContext()).addSignatureNS();
        ReferenceList dataRefList = null;
        EncryptedKeyType ekt = null;
        WSSPolicy wssPolicy = (WSSPolicy)context.getSecurityPolicy();
        EncryptionPolicy.FeatureBinding featureBinding =(EncryptionPolicy.FeatureBindingwssPolicy.getFeatureBinding();
        WSSPolicy keyBinding = (WSSPolicy)wssPolicy.getKeyBinding();
        EncryptedKey ek = null;
        KeyInfo edKeyInfo = null;
       
       
        if(logger.isLoggable(Level.FINEST)){
            logger.log(Level.FINEST, LogStringsMessages.WSS_1952_ENCRYPTION_KEYBINDING_VALUE(keyBinding));
        }
       
        if(PolicyTypeUtil.derivedTokenKeyBinding(keyBinding)){
            DerivedTokenKeyBinding dtk = (DerivedTokenKeyBinding)keyBinding.clone();
            WSSPolicy originalKeyBinding = dtk.getOriginalKeyBinding();
           
            if (PolicyTypeUtil.x509CertificateBinding(originalKeyBinding)){
                AuthenticationTokenPolicy.X509CertificateBinding ckBindingClone =
                        (AuthenticationTokenPolicy.X509CertificateBinding)originalKeyBinding.clone();
                //create a symmetric key binding and set it as original key binding of dkt
                SymmetricKeyBinding skb = new SymmetricKeyBinding();
                skb.setKeyBinding(ckBindingClone);
                // set the x509 binding as key binding of symmetric binding
                dtk.setOriginalKeyBinding(skb);
                //keyBinding = dtk;
                EncryptionPolicy ep = (EncryptionPolicy)wssPolicy.clone();
                ep.setKeyBinding(dtk);
                context.setSecurityPolicy(ep);
                wssPolicy = ep;
            }
        }
       
        TokenProcessor tp = new TokenProcessor((EncryptionPolicy) wssPolicy, context);
        BuilderResult tokenInfo = tp.process();
        Key dataEncKey = null;
        Key dkEncKey = null;
        dataEncKey = tokenInfo.getDataProtectionKey();
        ek = tokenInfo.getEncryptedKey();
        ArrayList targets =  featureBinding.getTargetBindings();
        Iterator targetItr = targets.iterator();
       
        ETHandler edBuilder =  new ETHandler(context.getSOAPVersion());
        EncryptionPolicy.FeatureBinding  binding = (FeatureBinding) wssPolicy.getFeatureBinding();
        dataRefList = new ReferenceList();
       
        if(ek == null || binding.getUseStandAloneRefList()){
            edKeyInfo = tokenInfo.getKeyInfo();
        }
       
        boolean refAdded = false;
        while (targetItr.hasNext()) {
            EncryptionTarget target = (EncryptionTarget)targetItr.next();
            boolean contentOnly = target.getContentOnly();
            //target.getDataEncryptionAlgorithm();
            //target.getCipherReferenceTransforms();//TODO support this
           
            List edList = edBuilder.buildEDList( (EncryptionPolicy)wssPolicy,target ,context, dataEncKey,edKeyInfo);
            for(int i =0;i< edList.size();i++){
                JAXBElement<ReferenceType> rt = elementFactory.createDataReference((SecurityElement)edList.get(i));
                dataRefList.getDataReferenceOrKeyReference().add(rt);
               
                refAdded = true;
            }
        }
        if(refAdded){
View Full Code Here

Examples of org.apache.aries.blueprint.annotation.ReferenceList

                        Reference ref = (Reference)fields[i].getAnnotation(Reference.class);
                        Treference tref = generateTref(ref, reflMap);
                        components.add(tref);
                    } else if (fields[i].isAnnotationPresent(ReferenceList.class)) {
                        // the field is also annotated with @ReferenceList
                        ReferenceList ref = (ReferenceList)fields[i].getAnnotation(ReferenceList.class);
                        TreferenceList tref = generateTrefList(ref, reflMap);
                        components.add(tref);
                       
                    } else {
                        Tproperty tp = createTproperty(fields[i].getName(), fields[i].getAnnotation(Inject.class));
View Full Code Here

Examples of org.apache.aries.blueprint.annotation.ReferenceList

                        Reference ref = fields[i].getAnnotation(Reference.class);
                        Treference tref = generateTref(ref, reflMap);
                        components.add(tref);
                    } else if (fields[i].isAnnotationPresent(ReferenceList.class)) {
                        // the field is also annotated with @ReferenceList
                        ReferenceList ref = fields[i].getAnnotation(ReferenceList.class);
                        TreferenceList tref = generateTrefList(ref, reflMap);
                        components.add(tref);
                       
                    } else {
                        Tproperty tp = createTproperty(fields[i].getName(), fields[i].getAnnotation(Inject.class));
View Full Code Here

Examples of org.apache.aries.blueprint.annotation.ReferenceList

                        Reference ref = (Reference)fields[i].getAnnotation(Reference.class);
                        Treference tref = generateTref(ref, reflMap);
                        components.add(tref);
                    } else if (fields[i].isAnnotationPresent(ReferenceList.class)) {
                        // the field is also annotated with @ReferenceList
                        ReferenceList ref = (ReferenceList)fields[i].getAnnotation(ReferenceList.class);
                        TreferenceList tref = generateTrefList(ref, reflMap);
                        components.add(tref);
                       
                    } else {
                        Tproperty tp = createTproperty(fields[i].getName(), fields[i].getAnnotation(Inject.class));
View Full Code Here

Examples of org.apache.xml.security.binding.xmlenc.ReferenceList

    @Override
    public void handle(final InputProcessorChain inputProcessorChain, final XMLSecurityProperties securityProperties,
                       final Deque<XMLSecEvent> eventQueue, final Integer index) throws XMLSecurityException {

        final ReferenceList referenceList = (ReferenceList) parseStructure(eventQueue, index, securityProperties);

        //instantiate a new DecryptInputProcessor and add it to the chain
        inputProcessorChain.addProcessor(
                new DecryptInputProcessor(null, referenceList, (WSSSecurityProperties) securityProperties,
                        (WSInboundSecurityContext) inputProcessorChain.getSecurityContext()));
View Full Code Here

Examples of org.apache.xml.security.binding.xmlenc.ReferenceList

        }
        final XMLSecStartElement encryptedDataElement = xmlSecEvent.asStartElement();
        final Attribute idAttribute = encryptedDataElement.getAttributeByName(XMLSecurityConstants.ATT_NULL_Id);

        DecryptInputProcessor decryptInputProcessor =
                new DecryptInputProcessor(null, new ReferenceList(), (WSSSecurityProperties) securityProperties,
                        (WSInboundSecurityContext) inputProcessorChain.getSecurityContext()) {

                    @Override
                    protected ReferenceType matchesReferenceId(XMLSecStartElement xmlSecStartElement) {
                        if (xmlSecStartElement == encryptedDataElement) {
View Full Code Here

Examples of org.apache.xml.security.binding.xmlenc.ReferenceList

        }
        final XMLSecStartElement encryptedDataElement = xmlSecEvent.asStartElement();
        final Attribute idAttribute = encryptedDataElement.getAttributeByName(XMLSecurityConstants.ATT_NULL_Id);

        DecryptInputProcessor decryptInputProcessor =
                new DecryptInputProcessor(null, new ReferenceList(), (WSSSecurityProperties) securityProperties,
                        (WSInboundSecurityContext) inputProcessorChain.getSecurityContext()) {

                    @Override
                    protected ReferenceType matchesReferenceId(XMLSecStartElement xmlSecStartElement) {
                        if (xmlSecStartElement == encryptedDataElement) {
View Full Code Here

Examples of org.apache.xml.security.encryption.ReferenceList

        Document doc = db.newDocument();

        XMLCipher dataCipher = XMLCipher.getInstance();
        dataCipher.init(XMLCipher.DECRYPT_MODE, null);

        ReferenceList dataRefList = dataCipher.createReferenceList(ReferenceList.DATA_REFERENCE);
        Reference dataRef1 = dataRefList.newDataReference("#id1");
        dataRefList.add(dataRef1);
        Reference dataRef2 = dataRefList.newDataReference("#id2");
        dataRefList.add(dataRef2);
       
        assertEquals("#id1", dataRef1.getURI());

        ReferenceList keyRefList = dataCipher.createReferenceList(ReferenceList.KEY_REFERENCE);
        Reference keyRef10 = keyRefList.newKeyReference("#id10");
        keyRefList.add(keyRef10);
        Reference keyRef20 = keyRefList.newKeyReference("#id20");
        keyRefList.add(keyRef20);
       
        assertEquals("#id10", keyRef10.getURI());

        // See SANTUARIO-302
        // https://issues.apache.org/jira/browse/SANTUARIO-302
        Element dataRefListElement = dataCipher.martial(doc, dataRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, dataRefListElement.getLocalName());
        Element dataRef1Element = (Element)dataRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef1Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef1Element.getLocalName());
        assertEquals("#id1", dataRef1Element.getAttribute("URI"));
        Element dataRef2Element = (Element)dataRef1Element.getNextSibling();
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef2Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef2Element.getLocalName());
        assertEquals("#id2", dataRef2Element.getAttribute("URI"));
        assertNull(dataRef2Element.getNextSibling());
       
        Element keyRefListElement = dataCipher.martial(doc, keyRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, keyRefListElement.getLocalName());
        Element keyRef10Element = (Element)keyRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRef10Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, keyRef10Element.getLocalName());
        assertEquals("#id10", keyRef10Element.getAttribute("URI"));
        Element keyRef20Element = (Element)keyRef10Element.getNextSibling();
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRef20Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, keyRef20Element.getLocalName());
        assertEquals("#id20", keyRef20Element.getAttribute("URI"));
        assertNull(keyRef20Element.getNextSibling());

        // See SANTUARIO-304
        // https://issues.apache.org/jira/browse/SANTUARIO-304
        Iterator<Reference> iter = dataRefList.getReferences();
        Reference ref = iter.next();
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, ref.getType());
        assertEquals("#id1", ref.getURI());
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, ref.getType());
        assertEquals("#id2", ref.getURI());
        assertTrue(!iter.hasNext());
       
        iter = keyRefList.getReferences();
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, ref.getType());
        assertEquals("#id10", ref.getURI());
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, ref.getType());
View Full Code Here

Examples of org.apache.xml.security.encryption.ReferenceList

        Document doc = db.newDocument();

        XMLCipher dataCipher = XMLCipher.getInstance();
        dataCipher.init(XMLCipher.DECRYPT_MODE, null);

        ReferenceList dataRefList = dataCipher.createReferenceList(ReferenceList.DATA_REFERENCE);
        Reference dataRef1 = dataRefList.newDataReference("#id1");
        dataRefList.add(dataRef1);
        Reference dataRef2 = dataRefList.newDataReference("#id2");
        dataRefList.add(dataRef2);
       
        assertEquals("#id1", dataRef1.getURI());

        ReferenceList keyRefList = dataCipher.createReferenceList(ReferenceList.KEY_REFERENCE);
        Reference keyRef10 = keyRefList.newKeyReference("#id10");
        keyRefList.add(keyRef10);
        Reference keyRef20 = keyRefList.newKeyReference("#id20");
        keyRefList.add(keyRef20);
       
        assertEquals("#id10", keyRef10.getURI());

        // See SANTUARIO-302
        // https://issues.apache.org/jira/browse/SANTUARIO-302
        Element dataRefListElement = dataCipher.martial(doc, dataRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, dataRefListElement.getLocalName());
        Element dataRef1Element = (Element)dataRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef1Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef1Element.getLocalName());
        assertEquals("#id1", dataRef1Element.getAttribute("URI"));
        Element dataRef2Element = (Element)dataRef1Element.getNextSibling();
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef2Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef2Element.getLocalName());
        assertEquals("#id2", dataRef2Element.getAttribute("URI"));
        assertNull(dataRef2Element.getNextSibling());
       
        Element keyRefListElement = dataCipher.martial(doc, keyRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, keyRefListElement.getLocalName());
        Element keyRef10Element = (Element)keyRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRef10Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, keyRef10Element.getLocalName());
        assertEquals("#id10", keyRef10Element.getAttribute("URI"));
        Element keyRef20Element = (Element)keyRef10Element.getNextSibling();
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRef20Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, keyRef20Element.getLocalName());
        assertEquals("#id20", keyRef20Element.getAttribute("URI"));
        assertNull(keyRef20Element.getNextSibling());

        // See SANTUARIO-304
        // https://issues.apache.org/jira/browse/SANTUARIO-304
        Iterator<Reference> iter = dataRefList.getReferences();
        Reference ref = iter.next();
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, ref.getType());
        assertEquals("#id1", ref.getURI());
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, ref.getType());
        assertEquals("#id2", ref.getURI());
        assertTrue(!iter.hasNext());
       
        iter = keyRefList.getReferences();
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, ref.getType());
        assertEquals("#id10", ref.getURI());
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, ref.getType());
View Full Code Here

Examples of org.apache.xml.security.encryption.ReferenceList

        Document doc = db.newDocument();

        XMLCipher dataCipher = XMLCipher.getInstance();
        dataCipher.init(XMLCipher.DECRYPT_MODE, null);

        ReferenceList dataRefList = dataCipher.createReferenceList(ReferenceList.DATA_REFERENCE);
        Reference dataRef1 = dataRefList.newDataReference("#id1");
        dataRefList.add(dataRef1);
        Reference dataRef2 = dataRefList.newDataReference("#id2");
        dataRefList.add(dataRef2);
       
        assertEquals("#id1", dataRef1.getURI());

        ReferenceList keyRefList = dataCipher.createReferenceList(ReferenceList.KEY_REFERENCE);
        Reference keyRef10 = keyRefList.newKeyReference("#id10");
        keyRefList.add(keyRef10);
        Reference keyRef20 = keyRefList.newKeyReference("#id20");
        keyRefList.add(keyRef20);
       
        assertEquals("#id10", keyRef10.getURI());

        // See SANTUARIO-302
        // https://issues.apache.org/jira/browse/SANTUARIO-302
        Element dataRefListElement = dataCipher.martial(doc, dataRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, dataRefListElement.getLocalName());
        Element dataRef1Element = (Element)dataRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef1Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef1Element.getLocalName());
        assertEquals("#id1", dataRef1Element.getAttribute("URI"));
        Element dataRef2Element = (Element)dataRef1Element.getNextSibling();
        assertEquals(EncryptionConstants.EncryptionSpecNS, dataRef2Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef2Element.getLocalName());
        assertEquals("#id2", dataRef2Element.getAttribute("URI"));
        assertNull(dataRef2Element.getNextSibling());
       
        Element keyRefListElement = dataCipher.martial(doc, keyRefList);
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRefListElement.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_REFERENCELIST, keyRefListElement.getLocalName());
        Element keyRef10Element = (Element)keyRefListElement.getFirstChild();
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRef10Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, keyRef10Element.getLocalName());
        assertEquals("#id10", keyRef10Element.getAttribute("URI"));
        Element keyRef20Element = (Element)keyRef10Element.getNextSibling();
        assertEquals(EncryptionConstants.EncryptionSpecNS, keyRef20Element.getNamespaceURI());
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, keyRef20Element.getLocalName());
        assertEquals("#id20", keyRef20Element.getAttribute("URI"));
        assertNull(keyRef20Element.getNextSibling());

        // See SANTUARIO-304
        // https://issues.apache.org/jira/browse/SANTUARIO-304
        Iterator<Reference> iter = dataRefList.getReferences();
        Reference ref = iter.next();
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, ref.getType());
        assertEquals("#id1", ref.getURI());
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_DATAREFERENCE, ref.getType());
        assertEquals("#id2", ref.getURI());
        assertTrue(!iter.hasNext());
       
        iter = keyRefList.getReferences();
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, ref.getType());
        assertEquals("#id10", ref.getURI());
        ref = iter.next();
        assertEquals(EncryptionConstants._TAG_KEYREFERENCE, ref.getType());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.