ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1172285 [25/48] - in /webservices/wss4j/branches/swssf: ./ cxf-integration/ cxf-integration/src/ cxf-integration/src/main/ cxf-integration/src/main/java/ cxf-integration/src/main/java/org/ cxf-integration/src/main/java/org/swssf/ cxf-integ...
Date Sun, 18 Sep 2011 13:51:36 GMT
Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/CanonicalizerBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/CanonicalizerBase.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/CanonicalizerBase.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/CanonicalizerBase.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,524 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.transformer.canonicalizer;
+
+import org.swssf.ext.*;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.*;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public abstract class CanonicalizerBase implements Transformer {
+
+    protected static final byte[] _END_PI = {'?', '>'};
+    protected static final byte[] _BEGIN_PI = {'<', '?'};
+    protected static final byte[] _END_COMM = {'-', '-', '>'};
+    protected static final byte[] _BEGIN_COMM = {'<', '!', '-', '-'};
+    protected static final byte[] __XA_ = {'&', '#', 'x', 'A', ';'};
+    protected static final byte[] __X9_ = {'&', '#', 'x', '9', ';'};
+    protected static final byte[] _QUOT_ = {'&', 'q', 'u', 'o', 't', ';'};
+    protected static final byte[] __XD_ = {'&', '#', 'x', 'D', ';'};
+    protected static final byte[] _GT_ = {'&', 'g', 't', ';'};
+    protected static final byte[] _LT_ = {'&', 'l', 't', ';'};
+    protected static final byte[] _END_TAG = {'<', '/'};
+    protected static final byte[] _AMP_ = {'&', 'a', 'm', 'p', ';'};
+    protected static final byte[] EQUAL_STRING = {'=', '\"'};
+    protected static final byte[] NEWLINE = {'\n'};
+
+    protected static final String XML = "xml";
+    protected static final String XMLNS = "xmlns";
+
+    private enum DocumentLevel {
+        NODE_BEFORE_DOCUMENT_ELEMENT,
+        NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT,
+        NODE_AFTER_DOCUMENT_ELEMENT
+    }
+
+    private OutputStream outputStream;
+
+    private Map<String, byte[]> cache = new HashMap<String, byte[]>();
+    private C14NStack<List<Comparable>> outputStack = new C14NStack<List<Comparable>>();
+    private boolean includeComments = false;
+    private DocumentLevel currentDocumentLevel = DocumentLevel.NODE_BEFORE_DOCUMENT_ELEMENT;
+    private boolean firstCall = true;
+    private SortedSet<String> inclusiveNamespaces = null;
+
+    public CanonicalizerBase(String inclusiveNamespaces, boolean includeComments, OutputStream outputStream) {
+        this.includeComments = includeComments;
+        this.inclusiveNamespaces = prefixStr2Set(inclusiveNamespaces);
+        this.outputStream = outputStream;
+    }
+
+    public static SortedSet<String> prefixStr2Set(String inclusiveNamespaces) {
+
+        if ((inclusiveNamespaces == null) || (inclusiveNamespaces.length() == 0)) {
+            return null;
+        }
+
+        SortedSet<String> prefixes = new TreeSet<String>();
+        StringTokenizer st = new StringTokenizer(inclusiveNamespaces, " \t\r\n");
+
+        while (st.hasMoreTokens()) {
+            String prefix = st.nextToken();
+
+            if (prefix.equals("#default")) {
+                prefixes.add("");
+            } else {
+                prefixes.add(prefix);
+            }
+        }
+        return prefixes;
+    }
+
+    protected void getCurrentUtilizedNamespaces(XMLEventNS xmlEventNS, SortedSet<ComparableNamespace> utilizedNamespaces, C14NStack<List<Comparable>> outputStack) {
+        List<ComparableNamespace> currentUtilizedNamespace = xmlEventNS.getNamespaceList()[0];
+        for (int j = 0; j < currentUtilizedNamespace.size(); j++) {
+            ComparableNamespace comparableNamespace = currentUtilizedNamespace.get(j);
+
+            final ComparableNamespace found = (ComparableNamespace) outputStack.containsOnStack(comparableNamespace);
+            //found means the prefix matched. so check the ns further
+            if (found != null && found.getNamespaceURI() != null && found.getNamespaceURI().equals(comparableNamespace.getNamespaceURI())) {
+                continue;
+            }
+
+            utilizedNamespaces.add(comparableNamespace);
+            outputStack.peek().add(comparableNamespace);
+        }
+    }
+
+    protected void getCurrentUtilizedAttributes(XMLEventNS xmlEventNS, SortedSet<ComparableAttribute> utilizedAttributes, C14NStack<List<Comparable>> outputStack) {
+        StartElement startElement = xmlEventNS.asStartElement();
+        @SuppressWarnings("unchecked")
+        Iterator<Attribute> attributesIterator = startElement.getAttributes();
+        while (attributesIterator.hasNext()) {
+            Attribute attribute = attributesIterator.next();
+            utilizedAttributes.add(new ComparableAttribute(attribute.getName(), attribute.getValue()));
+        }
+    }
+
+    protected void getInitialUtilizedNamespaces(XMLEventNS xmlEventNS, SortedSet<ComparableNamespace> utilizedNamespaces, C14NStack<List<Comparable>> outputStack) {
+        List<ComparableNamespace>[] visibleNamespaceList = xmlEventNS.getNamespaceList();
+        for (int i = 0; i < visibleNamespaceList.length; i++) {
+            List<ComparableNamespace> initialUtilizedNamespace = visibleNamespaceList[i];
+            for (int j = 0; j < initialUtilizedNamespace.size(); j++) {
+                ComparableNamespace comparableNamespace = initialUtilizedNamespace.get(j);
+
+                final ComparableNamespace found = (ComparableNamespace) outputStack.containsOnStack(comparableNamespace);
+                //found means the prefix matched. so check the ns further
+                if (found != null && found.getNamespaceURI() != null && found.getNamespaceURI().equals(comparableNamespace.getNamespaceURI())) {
+                    continue;
+                }
+
+                utilizedNamespaces.add(comparableNamespace);
+                outputStack.peek().add(comparableNamespace);
+            }
+        }
+    }
+
+    protected void getInitialUtilizedAttributes(XMLEventNS xmlEventNS, SortedSet<ComparableAttribute> utilizedAttributes, C14NStack<List<Comparable>> outputStack) {
+        List<ComparableAttribute>[] visibleAttributeList = xmlEventNS.getAttributeList();
+        for (int i = 0; i < visibleAttributeList.length; i++) {
+            List<ComparableAttribute> comparableAttributes = visibleAttributeList[i];
+            for (int j = 0; j < comparableAttributes.size(); j++) {
+                ComparableAttribute comparableAttribute = comparableAttributes.get(j);
+                if (outputStack.containsOnStack(comparableAttribute) != null) {
+                    continue;
+                }
+                utilizedAttributes.add(comparableAttribute);
+                outputStack.peek().add(comparableAttribute);
+            }
+        }
+        StartElement startElement = xmlEventNS.asStartElement();
+        @SuppressWarnings("unchecked")
+        Iterator<Attribute> attributesIterator = startElement.getAttributes();
+        while (attributesIterator.hasNext()) {
+            Attribute attribute = attributesIterator.next();
+            //attributes with xml prefix are already processed in the for loop above
+            if (XML.equals(attribute.getName().getPrefix())) {
+                continue;
+            }
+
+            utilizedAttributes.add(new ComparableAttribute(attribute.getName(), attribute.getValue()));
+        }
+    }
+
+    public void transform(XMLEvent xmlEvent) throws XMLStreamException {
+        try {
+            switch (xmlEvent.getEventType()) {
+                case XMLStreamConstants.START_ELEMENT:
+
+                    StartElement startElement = xmlEvent.asStartElement();
+
+                    currentDocumentLevel = DocumentLevel.NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
+                    outputStack.push(new ArrayList<Comparable>());
+
+                    XMLEventNS xmlEventNS = (XMLEventNS) xmlEvent;
+
+                    SortedSet<ComparableNamespace> utilizedNamespaces = new TreeSet<ComparableNamespace>();
+                    SortedSet<ComparableAttribute> utilizedAttributes = new TreeSet<ComparableAttribute>();
+
+                    if (firstCall) {
+                        outputStack.peek().add(new ComparableNamespace(""));
+                        outputStack.push(new ArrayList<Comparable>());
+                        firstCall = false;
+
+                        if (this.inclusiveNamespaces != null) {
+
+                            Iterator<String> iterator = this.inclusiveNamespaces.iterator();
+                            while (iterator.hasNext()) {
+                                String next = iterator.next();
+                                String ns = startElement.getNamespaceURI(next);
+                                //add default ns:
+                                if (ns == null && "".equals(next)) {
+                                    ComparableNamespace comparableNamespace = new ComparableNamespace(next, "");
+                                    utilizedNamespaces.add(comparableNamespace);
+                                    outputStack.peek().add(comparableNamespace);
+                                } else if (ns != null) {
+                                    ComparableNamespace comparableNamespace = new ComparableNamespace(next, ns);
+                                    utilizedNamespaces.add(comparableNamespace);
+                                    outputStack.peek().add(comparableNamespace);
+                                }
+                            }
+                        }
+
+                        getInitialUtilizedNamespaces(xmlEventNS, utilizedNamespaces, outputStack);
+                        getInitialUtilizedAttributes(xmlEventNS, utilizedAttributes, outputStack);
+                    } else {
+                        getCurrentUtilizedNamespaces(xmlEventNS, utilizedNamespaces, outputStack);
+                        getCurrentUtilizedAttributes(xmlEventNS, utilizedAttributes, outputStack);
+                    }
+
+                    outputStream.write('<');
+                    String prefix = startElement.getName().getPrefix();
+                    if (prefix != null && prefix.length() > 0) {
+                        UtfHelpper.writeByte(prefix, outputStream, cache);
+                        outputStream.write(':');
+                    }
+                    String name = startElement.getName().getLocalPart();
+                    UtfHelpper.writeByte(name, outputStream, cache);
+
+                    Iterator<ComparableNamespace> namespaceIterator = utilizedNamespaces.iterator();
+                    while (namespaceIterator.hasNext()) {
+                        ComparableNamespace namespace = namespaceIterator.next();
+
+                        if (!namespaceIsAbsolute(namespace.getNamespaceURI())) {
+                            throw new XMLStreamException("namespace is relative encountered: " + namespace.getNamespaceURI());
+                        }
+
+                        if (namespace.isDefaultNamespaceDeclaration()) {
+                            outputAttrToWriter(XMLNS, namespace.getNamespaceURI(), outputStream, cache);
+                        } else {
+                            outputAttrToWriter(XMLNS + ":" + namespace.getPrefix(), namespace.getNamespaceURI(), outputStream, cache);
+                        }
+                    }
+
+                    Iterator<ComparableAttribute> attributeIterator = utilizedAttributes.iterator();
+                    while (attributeIterator.hasNext()) {
+                        ComparableAttribute attribute = attributeIterator.next();
+
+                        String localPart = "";
+                        if (attribute.getName().getPrefix() != null && attribute.getName().getPrefix().length() > 0) {
+                            localPart += attribute.getName().getPrefix() + ":";
+                        }
+                        localPart += attribute.getName().getLocalPart();
+                        outputAttrToWriter(localPart,
+                                attribute.getValue(),
+                                outputStream, cache);
+                    }
+
+                    outputStream.write('>');
+                    break;
+                case XMLStreamConstants.END_ELEMENT:
+                    EndElement endElement = xmlEvent.asEndElement();
+                    String localName = endElement.getName().getLocalPart();
+                    String localPrefix = endElement.getName().getPrefix();
+                    outputStream.write(_END_TAG);
+                    if (localPrefix != null && localPrefix.length() > 0) {
+                        UtfHelpper.writeByte(localPrefix, outputStream, cache);
+                        outputStream.write(':');
+                    }
+                    UtfHelpper.writeStringToUtf8(localName, outputStream);
+                    outputStream.write('>');
+
+                    //We finished with this level, pop to the previous definitions.
+                    outputStack.pop();
+                    if (outputStack.size() == 1) {
+                        currentDocumentLevel = DocumentLevel.NODE_AFTER_DOCUMENT_ELEMENT;
+                    }
+
+                    break;
+                case XMLStreamConstants.PROCESSING_INSTRUCTION:
+                    outputPItoWriter(((ProcessingInstruction) xmlEvent), this.outputStream, currentDocumentLevel);
+                    break;
+                case XMLStreamConstants.CHARACTERS:
+                    if (currentDocumentLevel == DocumentLevel.NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT) {
+                        outputTextToWriter(xmlEvent.asCharacters().getData(), this.outputStream);
+                    }
+                    break;
+                case XMLStreamConstants.COMMENT:
+                    if (includeComments) {
+                        outputCommentToWriter(((Comment) xmlEvent), this.outputStream, currentDocumentLevel);
+                    }
+                    break;
+                case XMLStreamConstants.SPACE:
+                    if (currentDocumentLevel == DocumentLevel.NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT) {
+                        outputTextToWriter(xmlEvent.asCharacters().getData(), this.outputStream);
+                    }
+                    break;
+                case XMLStreamConstants.START_DOCUMENT:
+                    currentDocumentLevel = DocumentLevel.NODE_BEFORE_DOCUMENT_ELEMENT;
+                    break;
+                case XMLStreamConstants.END_DOCUMENT:
+                    break;
+                case XMLStreamConstants.ENTITY_REFERENCE:
+                    throw new XMLStreamException("illegal event :" + Utils.getXMLEventAsString(xmlEvent));
+                case XMLStreamConstants.ATTRIBUTE:
+                    throw new XMLStreamException("illegal event :" + Utils.getXMLEventAsString(xmlEvent));
+                case XMLStreamConstants.DTD:
+                    break;
+                case XMLStreamConstants.CDATA:
+                    outputTextToWriter(xmlEvent.asCharacters().getData(), this.outputStream);
+                    break;
+                case XMLStreamConstants.NAMESPACE:
+                    throw new XMLStreamException("illegal event :" + Utils.getXMLEventAsString(xmlEvent));
+                case XMLStreamConstants.NOTATION_DECLARATION:
+                    throw new XMLStreamException("illegal event :" + Utils.getXMLEventAsString(xmlEvent));
+                case XMLStreamConstants.ENTITY_DECLARATION:
+                    throw new XMLStreamException("illegal event :" + Utils.getXMLEventAsString(xmlEvent));
+            }
+        } catch (IOException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    protected static void outputAttrToWriter(final String name, final String value, final OutputStream writer,
+                                             final Map<String, byte[]> cache) throws IOException {
+        writer.write(' ');
+        UtfHelpper.writeByte(name, writer, cache);
+        writer.write(EQUAL_STRING);
+        byte[] toWrite;
+        final int length = value.length();
+        int i = 0;
+        while (i < length) {
+            char c = value.charAt(i++);
+
+            switch (c) {
+
+                case '&':
+                    toWrite = _AMP_;
+                    break;
+
+                case '<':
+                    toWrite = _LT_;
+                    break;
+
+                case '"':
+                    toWrite = _QUOT_;
+                    break;
+
+                case 0x09:    // '\t'
+                    toWrite = __X9_;
+                    break;
+
+                case 0x0A:    // '\n'
+                    toWrite = __XA_;
+                    break;
+
+                case 0x0D:    // '\r'
+                    toWrite = __XD_;
+                    break;
+
+                default:
+                    if (c < 0x80) {
+                        writer.write(c);
+                    } else {
+                        UtfHelpper.writeCharToUtf8(c, writer);
+                    }
+                    continue;
+            }
+            writer.write(toWrite);
+        }
+
+        writer.write('\"');
+    }
+
+    /**
+     * Outputs a Text of CDATA section to the internal Writer.
+     *
+     * @param text
+     * @param writer writer where to write the things
+     * @throws IOException
+     */
+    protected static void outputTextToWriter(final String text, final OutputStream writer) throws IOException {
+        final int length = text.length();
+        byte[] toWrite;
+        for (int i = 0; i < length; i++) {
+            char c = text.charAt(i);
+
+            switch (c) {
+
+                case '&':
+                    toWrite = _AMP_;
+                    break;
+
+                case '<':
+                    toWrite = _LT_;
+                    break;
+
+                case '>':
+                    toWrite = _GT_;
+                    break;
+
+                case 0xD:
+                    toWrite = __XD_;
+                    break;
+
+                default:
+                    if (c < 0x80) {
+                        writer.write(c);
+                    } else {
+                        UtfHelpper.writeCharToUtf8(c, writer);
+                    }
+                    continue;
+            }
+            writer.write(toWrite);
+        }
+    }
+
+    /**
+     * Outputs a PI to the internal Writer.
+     *
+     * @param currentPI
+     * @param writer    where to write the things
+     * @throws IOException
+     */
+    protected static void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer, DocumentLevel position) throws IOException {
+        if (position == DocumentLevel.NODE_AFTER_DOCUMENT_ELEMENT) {
+            writer.write(NEWLINE);
+        }
+        writer.write(_BEGIN_PI);
+
+        final String target = currentPI.getTarget();
+        int length = target.length();
+
+        for (int i = 0; i < length; i++) {
+            char c = target.charAt(i);
+            if (c == 0x0D) {
+                writer.write(__XD_);
+            } else {
+                if (c < 0x80) {
+                    writer.write(c);
+                } else {
+                    UtfHelpper.writeCharToUtf8(c, writer);
+                }
+            }
+        }
+
+        final String data = currentPI.getData();
+
+        length = data.length();
+
+        if (length > 0) {
+            writer.write(' ');
+
+            for (int i = 0; i < length; i++) {
+                char c = data.charAt(i);
+                if (c == 0x0D) {
+                    writer.write(__XD_);
+                } else {
+                    UtfHelpper.writeCharToUtf8(c, writer);
+                }
+            }
+        }
+
+        writer.write(_END_PI);
+        if (position == DocumentLevel.NODE_BEFORE_DOCUMENT_ELEMENT) {
+            writer.write(NEWLINE);
+        }
+    }
+
+    /**
+     * Method outputCommentToWriter
+     *
+     * @param currentComment
+     * @param writer         writer where to write the things
+     * @throws IOException
+     */
+    protected static void outputCommentToWriter(Comment currentComment, OutputStream writer, DocumentLevel position) throws IOException {
+        if (position == DocumentLevel.NODE_AFTER_DOCUMENT_ELEMENT) {
+            writer.write(NEWLINE);
+        }
+        writer.write(_BEGIN_COMM);
+
+        final String data = currentComment.getText();
+        final int length = data.length();
+
+        for (int i = 0; i < length; i++) {
+            char c = data.charAt(i);
+            if (c == 0x0D) {
+                writer.write(__XD_);
+            } else {
+                if (c < 0x80) {
+                    writer.write(c);
+                } else {
+                    UtfHelpper.writeCharToUtf8(c, writer);
+                }
+            }
+        }
+
+        writer.write(_END_COMM);
+        if (position == DocumentLevel.NODE_BEFORE_DOCUMENT_ELEMENT) {
+            writer.write(NEWLINE);
+        }
+    }
+
+    private boolean namespaceIsAbsolute(String namespaceValue) {
+        // assume empty namespaces are absolute
+        if (namespaceValue.length() == 0) {
+            return true;
+        }
+        return namespaceValue.indexOf(':') > 0;
+    }
+
+
+    public static class C14NStack<E> extends ArrayDeque<List<Comparable>> {
+
+        public Object containsOnStack(Object o) {
+            if (o == null) {
+                return null;
+            }
+            //Important: iteration order from head to tail!
+            Iterator<List<Comparable>> elementIterator = super.iterator();
+            while (elementIterator.hasNext()) {
+                List list = elementIterator.next();
+                if (list.contains(o)) {
+                    return list.get(list.indexOf(o));
+                }
+            }
+            return null;
+        }
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/CanonicalizerBase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/UtfHelpper.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/UtfHelpper.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/UtfHelpper.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/UtfHelpper.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,170 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.transformer.canonicalizer;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Map;
+
+public class UtfHelpper {
+
+    static void writeByte(final String str, final OutputStream out, Map<String, byte[]> cache) throws IOException {
+        byte[] result = cache.get(str);
+        if (result == null) {
+            result = getStringInUtf8(str);
+            cache.put(str, result);
+        }
+
+        out.write(result);
+
+    }
+
+    static void writeCharToUtf8(final char c, final OutputStream out) throws IOException {
+        if (c < 0x80) {
+            out.write(c);
+            return;
+        }
+        if ((c >= 0xD800 && c <= 0xDBFF) || (c >= 0xDC00 && c <= 0xDFFF)) {
+            //No Surrogates in sun java
+            out.write(0x3f);
+            return;
+        }
+        int bias;
+        int write;
+        char ch;
+        if (c > 0x07FF) {
+            ch = (char) (c >>> 12);
+            write = 0xE0;
+            if (ch > 0) {
+                write |= (ch & 0x0F);
+            }
+            out.write(write);
+            write = 0x80;
+            bias = 0x3F;
+        } else {
+            write = 0xC0;
+            bias = 0x1F;
+        }
+        ch = (char) (c >>> 6);
+        if (ch > 0) {
+            write |= (ch & bias);
+        }
+        out.write(write);
+        out.write(0x80 | ((c) & 0x3F));
+
+    }
+
+    static void writeStringToUtf8(final String str, final OutputStream out) throws IOException {
+        final int length = str.length();
+        int i = 0;
+        char c;
+        while (i < length) {
+            c = str.charAt(i++);
+            if (c < 0x80) {
+                out.write(c);
+                continue;
+            }
+            if ((c >= 0xD800 && c <= 0xDBFF) || (c >= 0xDC00 && c <= 0xDFFF)) {
+                //No Surrogates in sun java
+                out.write(0x3f);
+                continue;
+            }
+            char ch;
+            int bias;
+            int write;
+            if (c > 0x07FF) {
+                ch = (char) (c >>> 12);
+                write = 0xE0;
+                if (ch > 0) {
+                    write |= (ch & 0x0F);
+                }
+                out.write(write);
+                write = 0x80;
+                bias = 0x3F;
+            } else {
+                write = 0xC0;
+                bias = 0x1F;
+            }
+            ch = (char) (c >>> 6);
+            if (ch > 0) {
+                write |= (ch & bias);
+            }
+            out.write(write);
+            out.write(0x80 | ((c) & 0x3F));
+
+        }
+    }
+
+    public static byte[] getStringInUtf8(final String str) {
+        final int length = str.length();
+        boolean expanded = false;
+        byte[] result = new byte[length];
+        int i = 0;
+        int out = 0;
+        char c;
+        while (i < length) {
+            c = str.charAt(i++);
+            if (c < 0x80) {
+                result[out++] = (byte) c;
+                continue;
+            }
+            if ((c >= 0xD800 && c <= 0xDBFF) || (c >= 0xDC00 && c <= 0xDFFF)) {
+                //No Surrogates in sun java
+                result[out++] = 0x3f;
+
+                continue;
+            }
+            if (!expanded) {
+                byte newResult[] = new byte[3 * length];
+                System.arraycopy(result, 0, newResult, 0, out);
+                result = newResult;
+                expanded = true;
+            }
+            char ch;
+            int bias;
+            byte write;
+            if (c > 0x07FF) {
+                ch = (char) (c >>> 12);
+                write = (byte) 0xE0;
+                if (ch > 0) {
+                    write |= (ch & 0x0F);
+                }
+                result[out++] = write;
+                write = (byte) 0x80;
+                bias = 0x3F;
+            } else {
+                write = (byte) 0xC0;
+                bias = 0x1F;
+            }
+            ch = (char) (c >>> 6);
+            if (ch > 0) {
+                write |= (ch & bias);
+            }
+            result[out++] = write;
+            result[out++] = (byte) (0x80 | ((c) & 0x3F));/**/
+
+        }
+        if (expanded) {
+            byte newResult[] = new byte[out];
+            System.arraycopy(result, 0, newResult, 0, out);
+            result = newResult;
+        }
+        return result;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/transformer/canonicalizer/UtfHelpper.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ConcreteLSInput.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ConcreteLSInput.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ConcreteLSInput.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ConcreteLSInput.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.util;
+
+import org.w3c.dom.ls.LSInput;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class ConcreteLSInput implements LSInput {
+
+    private Reader reader;
+    private InputStream inputStream;
+    private String stringData;
+    private String systemId;
+    private String publicId;
+    private String baseURI;
+    private String encoding;
+    private boolean certifiedText;
+
+    public Reader getCharacterStream() {
+        return this.reader;
+    }
+
+    public void setCharacterStream(Reader characterStream) {
+        this.reader = characterStream;
+    }
+
+    public InputStream getByteStream() {
+        return this.inputStream;
+    }
+
+    public void setByteStream(InputStream byteStream) {
+        this.inputStream = byteStream;
+    }
+
+    public String getStringData() {
+        return this.stringData;
+    }
+
+    public void setStringData(String stringData) {
+        this.stringData = stringData;
+    }
+
+    public String getSystemId() {
+        return this.systemId;
+    }
+
+    public void setSystemId(String systemId) {
+        this.systemId = systemId;
+    }
+
+    public String getPublicId() {
+        return this.publicId;
+    }
+
+    public void setPublicId(String publicId) {
+        this.publicId = publicId;
+    }
+
+    public String getBaseURI() {
+        return this.baseURI;
+    }
+
+    public void setBaseURI(String baseURI) {
+        this.baseURI = baseURI;
+    }
+
+    public String getEncoding() {
+        return this.encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public boolean getCertifiedText() {
+        return this.certifiedText;
+    }
+
+    public void setCertifiedText(boolean certifiedText) {
+        this.certifiedText = certifiedText;
+    }
+}
\ No newline at end of file

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/DigestOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/DigestOutputStream.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/DigestOutputStream.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/DigestOutputStream.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.OutputStream;
+import java.security.MessageDigest;
+
+/**
+ * A Streaming based message-digest implementation
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class DigestOutputStream extends OutputStream {
+
+    protected static final transient Log log = LogFactory.getLog(DigestOutputStream.class);
+
+    private MessageDigest messageDigest;
+    private StringBuffer stringBuffer;
+
+    public DigestOutputStream(MessageDigest messageDigest) {
+        this.messageDigest = messageDigest;
+        if (log.isDebugEnabled()) {
+            stringBuffer = new StringBuffer();
+        }
+    }
+
+    public void write(byte[] arg0) {
+        write(arg0, 0, arg0.length);
+    }
+
+    public void write(int arg0) {
+        messageDigest.update((byte) arg0);
+        if (log.isDebugEnabled()) {
+            stringBuffer.append(new String(new byte[]{(byte) arg0}));
+        }
+    }
+
+    public void write(byte[] arg0, int arg1, int arg2) {
+        messageDigest.update(arg0, arg1, arg2);
+        if (log.isDebugEnabled()) {
+            stringBuffer.append(new String(arg0, arg1, arg2));
+        }
+    }
+
+    public byte[] getDigestValue() {
+        if (log.isDebugEnabled()) {
+            log.debug("Pre Digest: ");
+            log.debug(stringBuffer.toString());
+            log.debug("End pre Digest ");
+            stringBuffer = new StringBuffer();
+        }
+        return messageDigest.digest();
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/DigestOutputStream.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/IVSplittingOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/IVSplittingOutputStream.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/IVSplittingOutputStream.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/IVSplittingOutputStream.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.util;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+
+/**
+ * IV splitting from the first few bytes in the stream.
+ * When the iv is completely received the cipher will be initialized
+ * and this output stream will be removed from chain of output streams
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class IVSplittingOutputStream extends FilterOutputStream {
+
+    private ReplaceableOuputStream replaceableOuputStream;
+
+    private byte[] iv;
+    private int ivLength;
+    private int pos = 0;
+
+    private Cipher cipher;
+    private Key secretKey;
+
+    public IVSplittingOutputStream(OutputStream out, Cipher cipher, Key secretKey) {
+        super(out);
+        ivLength = cipher.getBlockSize();
+        iv = new byte[ivLength];
+        this.cipher = cipher;
+        this.secretKey = secretKey;
+    }
+
+    public byte[] getIv() {
+        return iv;
+    }
+
+    public boolean isIVComplete() {
+        return pos == iv.length;
+    }
+
+    private void initializeCipher() throws IOException {
+        IvParameterSpec iv = new IvParameterSpec(this.getIv());
+        try {
+            cipher.init(Cipher.DECRYPT_MODE, secretKey, iv);
+        } catch (InvalidKeyException e) {
+            throw new IOException(e);
+        } catch (InvalidAlgorithmParameterException e) {
+            throw new IOException(e);
+        }
+    }
+
+    @Override
+    public void write(int b) throws IOException {
+        if (pos >= ivLength) {
+            initializeCipher();
+            out.write(b);
+            replaceableOuputStream.setNewOutputStream(out);
+            return;
+        }
+        iv[pos++] = (byte) b;
+    }
+
+    @Override
+    public void write(byte[] b) throws IOException {
+        write(b, 0, b.length);
+    }
+
+    @Override
+    public void write(byte[] b, int off, int len) throws IOException {
+        int missingBytes = ivLength - pos;
+        if (missingBytes > len) {
+            System.arraycopy(b, off, iv, pos, len);
+            pos += len;
+        } else {
+            System.arraycopy(b, off, iv, pos, missingBytes);
+            pos += missingBytes;
+            initializeCipher();
+            out.write(b, off + missingBytes, len - missingBytes);
+            replaceableOuputStream.setNewOutputStream(out);
+        }
+    }
+
+    public void setParentOutputStream(ReplaceableOuputStream replaceableOuputStream) {
+        this.replaceableOuputStream = replaceableOuputStream;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/IVSplittingOutputStream.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/RFC2253Parser.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/RFC2253Parser.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/RFC2253Parser.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/RFC2253Parser.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,480 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.util;
+
+
+import java.io.IOException;
+import java.io.StringReader;
+
+/**
+ * class lent from apache santuario
+ */
+
+/**
+ * @author $Author$
+ */
+public class RFC2253Parser {
+
+    /**
+     * Method rfc2253toXMLdsig
+     *
+     * @param dn
+     * @return normalized string
+     */
+    public static String rfc2253toXMLdsig(String dn) {
+
+        // Transform from RFC1779 to RFC2253
+        String normalized = normalize(dn, true);
+
+        return rfctoXML(normalized);
+    }
+
+    /**
+     * Method xmldsigtoRFC2253
+     *
+     * @param dn
+     * @return normalized string
+     */
+    public static String xmldsigtoRFC2253(String dn) {
+
+        // Transform from RFC1779 to RFC2253
+        String normalized = normalize(dn, false);
+
+        return xmltoRFC(normalized);
+    }
+
+    /**
+     * Method normalize
+     *
+     * @param dn
+     * @return normalized string
+     */
+    public static String normalize(String dn, boolean toXML) {
+
+        //if empty string
+        if ((dn == null) || dn.equals("")) {
+            return "";
+        }
+
+        try {
+            String _DN = semicolonToComma(dn);
+            StringBuilder sb = new StringBuilder();
+            int i = 0;
+            int l = 0;
+            int k;
+
+            //for name component
+            for (int j = 0; (k = _DN.indexOf(",", j)) >= 0; j = k + 1) {
+                l += countQuotes(_DN, j, k);
+
+                if ((k > 0) && (_DN.charAt(k - 1) != '\\') && (l % 2) != 1) {
+                    sb.append(parseRDN(_DN.substring(i, k).trim(), toXML)).append(",");
+
+                    i = k + 1;
+                    l = 0;
+                }
+            }
+
+            sb.append(parseRDN(trim(_DN.substring(i)), toXML));
+
+            return sb.toString();
+        } catch (IOException ex) {
+            return dn;
+        }
+    }
+
+    /**
+     * Method parseRDN
+     *
+     * @param str
+     * @return normalized string
+     * @throws java.io.IOException
+     */
+    static String parseRDN(String str, boolean toXML) throws IOException {
+
+        StringBuilder sb = new StringBuilder();
+        int i = 0;
+        int l = 0;
+        int k;
+
+        for (int j = 0; (k = str.indexOf("+", j)) >= 0; j = k + 1) {
+            l += countQuotes(str, j, k);
+
+            if ((k > 0) && (str.charAt(k - 1) != '\\') && (l % 2) != 1) {
+                sb.append(parseATAV(trim(str.substring(i, k)), toXML)).append("+");
+
+                i = k + 1;
+                l = 0;
+            }
+        }
+
+        sb.append(parseATAV(trim(str.substring(i)), toXML));
+
+        return sb.toString();
+    }
+
+    /**
+     * Method parseATAV
+     *
+     * @param str
+     * @return normalized string
+     * @throws java.io.IOException
+     */
+    static String parseATAV(String str, boolean toXML) throws IOException {
+
+        int i = str.indexOf("=");
+
+        if ((i == -1) || ((i > 0) && (str.charAt(i - 1) == '\\'))) {
+            return str;
+        }
+        String attrType = normalizeAT(str.substring(0, i));
+        // only normalize if value is a String
+        String attrValue = null;
+        if (attrType.charAt(0) >= '0' && attrType.charAt(0) <= '9') {
+            attrValue = str.substring(i + 1);
+        } else {
+            attrValue = normalizeV(str.substring(i + 1), toXML);
+        }
+
+        return attrType + "=" + attrValue;
+
+    }
+
+    /**
+     * Method normalizeAT
+     *
+     * @param str
+     * @return normalized string
+     */
+    static String normalizeAT(String str) {
+
+        String at = str.toUpperCase().trim();
+
+        if (at.startsWith("OID")) {
+            at = at.substring(3);
+        }
+
+        return at;
+    }
+
+    /**
+     * Method normalizeV
+     *
+     * @param str
+     * @return normalized string
+     * @throws java.io.IOException
+     */
+    static String normalizeV(String str, boolean toXML) throws IOException {
+
+        String value = trim(str);
+
+        if (value.startsWith("\"")) {
+            StringBuilder sb = new StringBuilder();
+            StringReader sr = new StringReader(value.substring(1,
+                    value.length() - 1));
+            int i = 0;
+            char c;
+
+            for (; (i = sr.read()) > -1; ) {
+                c = (char) i;
+
+                //the following char is defined at 4.Relationship with RFC1779 and LDAPv2 inrfc2253
+                if ((c == ',') || (c == '=') || (c == '+') || (c == '<')
+                        || (c == '>') || (c == '#') || (c == ';')) {
+                    sb.append('\\');
+                }
+
+                sb.append(c);
+            }
+
+            value = trim(sb.toString());
+        }
+
+        if (toXML) {
+            if (value.startsWith("#")) {
+                value = '\\' + value;
+            }
+        } else {
+            if (value.startsWith("\\#")) {
+                value = value.substring(1);
+            }
+        }
+
+        return value;
+    }
+
+    /**
+     * Method rfctoXML
+     *
+     * @param string
+     * @return normalized string
+     */
+    static String rfctoXML(String string) {
+
+        try {
+            String s = changeLess32toXML(string);
+
+            return changeWStoXML(s);
+        } catch (Exception e) {
+            return string;
+        }
+    }
+
+    /**
+     * Method xmltoRFC
+     *
+     * @param string
+     * @return normalized string
+     */
+    static String xmltoRFC(String string) {
+
+        try {
+            String s = changeLess32toRFC(string);
+
+            return changeWStoRFC(s);
+        } catch (Exception e) {
+            return string;
+        }
+    }
+
+    /**
+     * Method changeLess32toRFC
+     *
+     * @param string
+     * @return normalized string
+     * @throws java.io.IOException
+     */
+    static String changeLess32toRFC(String string) throws IOException {
+
+        StringBuilder sb = new StringBuilder();
+        StringReader sr = new StringReader(string);
+        int i = 0;
+        char c;
+
+        for (; (i = sr.read()) > -1; ) {
+            c = (char) i;
+
+            if (c == '\\') {
+                sb.append(c);
+
+                char c1 = (char) sr.read();
+                char c2 = (char) sr.read();
+
+                //65 (A) 97 (a)
+                if ((((c1 >= 48) && (c1 <= 57)) || ((c1 >= 65) && (c1 <= 70)) || ((c1 >= 97) && (c1 <= 102)))
+                        && (((c2 >= 48) && (c2 <= 57))
+                        || ((c2 >= 65) && (c2 <= 70))
+                        || ((c2 >= 97) && (c2 <= 102)))) {
+                    char ch = (char) Byte.parseByte("" + c1 + c2, 16);
+
+                    sb.append(ch);
+                } else {
+                    sb.append(c1);
+                    sb.append(c2);
+                }
+            } else {
+                sb.append(c);
+            }
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * Method changeLess32toXML
+     *
+     * @param string
+     * @return normalized string
+     * @throws java.io.IOException
+     */
+    static String changeLess32toXML(String string) throws IOException {
+
+        StringBuilder sb = new StringBuilder();
+        StringReader sr = new StringReader(string);
+        int i = 0;
+
+        for (; (i = sr.read()) > -1; ) {
+            if (i < 32) {
+                sb.append('\\');
+                sb.append(Integer.toHexString(i));
+            } else {
+                sb.append((char) i);
+            }
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * Method changeWStoXML
+     *
+     * @param string
+     * @return normalized string
+     * @throws java.io.IOException
+     */
+    static String changeWStoXML(String string) throws IOException {
+
+        StringBuilder sb = new StringBuilder();
+        StringReader sr = new StringReader(string);
+        int i = 0;
+        char c;
+
+        for (; (i = sr.read()) > -1; ) {
+            c = (char) i;
+
+            if (c == '\\') {
+                char c1 = (char) sr.read();
+
+                if (c1 == ' ') {
+                    sb.append('\\');
+
+                    String s = "20";
+
+                    sb.append(s);
+                } else {
+                    sb.append('\\');
+                    sb.append(c1);
+                }
+            } else {
+                sb.append(c);
+            }
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * Method changeWStoRFC
+     *
+     * @param string
+     * @return normalized string
+     */
+    static String changeWStoRFC(String string) {
+
+        StringBuilder sb = new StringBuilder();
+        int i = 0;
+        int k;
+
+        for (int j = 0; (k = string.indexOf("\\20", j)) >= 0; j = k + 3) {
+            sb.append(trim(string.substring(i, k))).append("\\ ");
+
+            i = k + 3;
+        }
+
+        sb.append(string.substring(i));
+
+        return sb.toString();
+    }
+
+    /**
+     * Method semicolonToComma
+     *
+     * @param str
+     * @return normalized string
+     */
+    static String semicolonToComma(String str) {
+        return removeWSandReplace(str, ";", ",");
+    }
+
+    /**
+     * Method removeWhiteSpace
+     *
+     * @param str
+     * @param symbol
+     * @return normalized string
+     */
+    static String removeWhiteSpace(String str, String symbol) {
+        return removeWSandReplace(str, symbol, symbol);
+    }
+
+    /**
+     * Method removeWSandReplace
+     *
+     * @param str
+     * @param symbol
+     * @param replace
+     * @return normalized string
+     */
+    static String removeWSandReplace(String str, String symbol, String replace) {
+
+        StringBuilder sb = new StringBuilder();
+        int i = 0;
+        int l = 0;
+        int k;
+
+        for (int j = 0; (k = str.indexOf(symbol, j)) >= 0; j = k + 1) {
+            l += countQuotes(str, j, k);
+
+            if ((k > 0) && (str.charAt(k - 1) != '\\') && (l % 2) != 1) {
+                sb.append(trim(str.substring(i, k))).append(replace);
+
+                i = k + 1;
+                l = 0;
+            }
+        }
+
+        sb.append(trim(str.substring(i)));
+
+        return sb.toString();
+    }
+
+    /**
+     * Returns the number of Quotation from i to j
+     *
+     * @param s
+     * @param i
+     * @param j
+     * @return number of quotes
+     */
+    private static int countQuotes(String s, int i, int j) {
+
+        int k = 0;
+
+        for (int l = i; l < j; l++) {
+            if (s.charAt(l) == '"') {
+                k++;
+            }
+        }
+
+        return k;
+    }
+
+    //only for the end of a space character occurring at the end of the string from rfc2253
+
+    /**
+     * Method trim
+     *
+     * @param str
+     * @return the string
+     */
+    static String trim(String str) {
+
+        String trimed = str.trim();
+        int i = str.indexOf(trimed) + trimed.length();
+
+        if ((str.length() > i) && trimed.endsWith("\\")
+                && !trimed.endsWith("\\\\")) {
+            if (str.charAt(i) == ' ') {
+                trimed = trimed + " ";
+            }
+        }
+
+        return trimed;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/RFC2253Parser.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ReplaceableOuputStream.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ReplaceableOuputStream.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ReplaceableOuputStream.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ReplaceableOuputStream.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.util;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * A OutputStream which allows to replace another chained output-stream
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class ReplaceableOuputStream extends FilterOutputStream {
+
+    public ReplaceableOuputStream(OutputStream out) {
+        super(out);
+    }
+
+    public void setNewOutputStream(OutputStream outputStream) {
+        this.out = outputStream;
+    }
+
+    @Override
+    public void write(int b) throws IOException {
+        out.write(b);
+    }
+
+    @Override
+    public void write(byte[] b) throws IOException {
+        out.write(b);
+    }
+
+    @Override
+    public void write(byte[] b, int off, int len) throws IOException {
+        out.write(b, off, len);
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/ReplaceableOuputStream.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/SignerOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/SignerOutputStream.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/SignerOutputStream.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/SignerOutputStream.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.swssf.ext.WSSecurityException;
+import org.swssf.impl.algorithms.SignatureAlgorithm;
+
+import java.io.OutputStream;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class SignerOutputStream extends OutputStream {
+
+    protected static final transient Log log = LogFactory.getLog(SignerOutputStream.class);
+
+    private final SignatureAlgorithm signatureAlgorithm;
+    private StringBuffer stringBuffer;
+
+    public SignerOutputStream(SignatureAlgorithm signatureAlgorithm) {
+        this.signatureAlgorithm = signatureAlgorithm;
+        if (log.isDebugEnabled()) {
+            stringBuffer = new StringBuffer();
+        }
+    }
+
+    public void write(byte[] arg0) {
+        write(arg0, 0, arg0.length);
+    }
+
+    public void write(int arg0) {
+        try {
+            signatureAlgorithm.engineUpdate((byte) arg0);
+            if (log.isDebugEnabled()) {
+                stringBuffer.append(new String(new byte[]{(byte) arg0}));
+            }
+        } catch (WSSecurityException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void write(byte[] arg0, int arg1, int arg2) {
+        try {
+            signatureAlgorithm.engineUpdate(arg0, arg1, arg2);
+            if (log.isDebugEnabled()) {
+                stringBuffer.append(new String(arg0, arg1, arg2));
+            }
+        } catch (WSSecurityException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public boolean verify(byte[] signatureValue) throws WSSecurityException {
+        if (log.isDebugEnabled()) {
+            log.debug("Pre Signed: ");
+            log.debug(stringBuffer.toString());
+            log.debug("End pre Signed ");
+            stringBuffer = new StringBuffer();
+        }
+        return signatureAlgorithm.engineVerify(signatureValue);
+    }
+
+    public byte[] sign() throws WSSecurityException {
+        if (log.isDebugEnabled()) {
+            log.debug("Pre Signed: ");
+            log.debug(stringBuffer.toString());
+            log.debug("End pre Signed ");
+            stringBuffer = new StringBuffer();
+        }
+        return signatureAlgorithm.engineSign();
+    }
+}
\ No newline at end of file

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/SignerOutputStream.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/TrimmerOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/TrimmerOutputStream.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/TrimmerOutputStream.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/TrimmerOutputStream.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.impl.util;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Trimms the start and the end of a stream
+ *
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class TrimmerOutputStream extends FilterOutputStream {
+
+    private byte[] buffer;
+    private int bufferedCount;
+
+    private int preTrimmed = 0;
+    private int startTrimLength;
+    private int endTrimLength;
+
+    public TrimmerOutputStream(OutputStream out, int bufferSize, int startTrimLength, int endTrimLength) {
+        super(out);
+        if (bufferSize <= 0) {
+            throw new IllegalArgumentException("bufferSize <= 0");
+        }
+        if (bufferSize < endTrimLength) {
+            throw new IllegalArgumentException("bufferSize < endTrimLength");
+        }
+        this.buffer = new byte[bufferSize];
+        this.startTrimLength = startTrimLength;
+        this.endTrimLength = endTrimLength;
+    }
+
+    private void flushBuffer() throws IOException {
+        if (bufferedCount >= endTrimLength) {
+            //write all but the possible end (endTrimLength)
+            out.write(buffer, 0, bufferedCount - endTrimLength);
+            System.arraycopy(buffer, bufferedCount - endTrimLength, buffer, 0, endTrimLength);
+            bufferedCount = endTrimLength;
+        }
+    }
+
+    @Override
+    public void write(int b) throws IOException {
+        if (preTrimmed < startTrimLength) {
+            //discard byte
+            preTrimmed++;
+            return;
+        }
+        if (bufferedCount >= buffer.length) {
+            flushBuffer();
+        }
+        buffer[bufferedCount++] = (byte) b;
+    }
+
+    @Override
+    public void write(byte[] b) throws IOException {
+        write(b, 0, b.length);
+    }
+
+    @Override
+    public void write(byte[] b, int off, int len) throws IOException {
+        if (preTrimmed < startTrimLength) {
+            int missingBytes = startTrimLength - preTrimmed;
+            if (missingBytes >= len) {
+                //discard bytes
+                preTrimmed += len;
+                return;
+            }
+            len -= missingBytes;
+            off += missingBytes;
+            preTrimmed += missingBytes;
+        }
+
+        if (len >= (buffer.length - bufferedCount)) {
+            out.write(buffer, 0, bufferedCount);
+            out.write(b, off, len - endTrimLength);
+            System.arraycopy(b, (off + len) - endTrimLength, buffer, 0, endTrimLength);
+            bufferedCount = endTrimLength;
+            return;
+        }
+
+        System.arraycopy(b, off, buffer, bufferedCount, len);
+        bufferedCount += len;
+    }
+
+    @Override
+    public void flush() throws IOException {
+        flushBuffer();
+        out.flush();
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/impl/util/TrimmerOutputStream.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/AlgorithmSuiteSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/AlgorithmSuiteSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/AlgorithmSuiteSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/AlgorithmSuiteSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+import org.swssf.ext.Constants;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class AlgorithmSuiteSecurityEvent extends SecurityEvent {
+
+    //@see http://docs.oasis-open.org/ws-sx/ws-securitypolicy/v1.3/os/ws-securitypolicy-1.3-spec-os.html
+    //chapter 6.1
+
+    private String algorithmURI;
+    private Constants.KeyUsage keyUsage;
+
+    public AlgorithmSuiteSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+
+    public String getAlgorithmURI() {
+        return algorithmURI;
+    }
+
+    public void setAlgorithmURI(String algorithmURI) {
+        this.algorithmURI = algorithmURI;
+    }
+
+    public Constants.KeyUsage getKeyUsage() {
+        return keyUsage;
+    }
+
+    public void setKeyUsage(Constants.KeyUsage keyUsage) {
+        this.keyUsage = keyUsage;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/AlgorithmSuiteSecurityEvent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/ContentEncryptedElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/ContentEncryptedElementSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/ContentEncryptedElementSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/ContentEncryptedElementSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class ContentEncryptedElementSecurityEvent extends SecurityEvent {
+
+    //todo xpath or something unique
+    private QName element; //this contents parent element
+    private boolean notEncrypted; //if true this element is not encrypted.
+
+    public ContentEncryptedElementSecurityEvent(Event securityEventType, boolean notEncrypted) {
+        super(securityEventType);
+        this.notEncrypted = notEncrypted;
+    }
+
+    public QName getElement() {
+        return element;
+    }
+
+    public void setElement(QName element) {
+        this.element = element;
+    }
+
+    public boolean isNotEncrypted() {
+        return notEncrypted;
+    }
+
+    public void setNotEncrypted(boolean notEncrypted) {
+        this.notEncrypted = notEncrypted;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/ContentEncryptedElementSecurityEvent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedElementSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedElementSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedElementSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class EncryptedElementSecurityEvent extends SecurityEvent {
+
+    //todo xpath or something unique
+    private QName element;
+    private boolean notEncrypted; //if true this element is not encrypted.
+
+    public EncryptedElementSecurityEvent(Event securityEventType, boolean notEncrypted) {
+        super(securityEventType);
+        this.notEncrypted = notEncrypted;
+    }
+
+    public QName getElement() {
+        return element;
+    }
+
+    public void setElement(QName element) {
+        this.element = element;
+    }
+
+    public boolean isNotEncrypted() {
+        return notEncrypted;
+    }
+
+    public void setNotEncrypted(boolean notEncrypted) {
+        this.notEncrypted = notEncrypted;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedElementSecurityEvent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedPartSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedPartSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedPartSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedPartSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class EncryptedPartSecurityEvent extends SecurityEvent {
+
+    //todo xpath or something unique
+    private QName element;
+    private boolean notEncrypted; //if true this element is not encrypted.
+
+    public EncryptedPartSecurityEvent(Event securityEventType, boolean notEncrypted) {
+        super(securityEventType);
+        this.notEncrypted = notEncrypted;
+    }
+
+    public QName getElement() {
+        return element;
+    }
+
+    public void setElement(QName element) {
+        this.element = element;
+    }
+
+    public boolean isNotEncrypted() {
+        return notEncrypted;
+    }
+
+    public void setNotEncrypted(boolean notEncrypted) {
+        this.notEncrypted = notEncrypted;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptedPartSecurityEvent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptionTokenSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptionTokenSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptionTokenSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/EncryptionTokenSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,30 @@
+ /**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+/**
+ * @author $Author: giger $
+ * @version $Revision: 272 $ $Date: 2010-12-23 14:30:56 +0100 (Thu, 23 Dec 2010) $
+ */
+public class EncryptionTokenSecurityEvent extends TokenSecurityEvent {
+
+    public EncryptionTokenSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+}

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/HttpsTokenSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/HttpsTokenSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/HttpsTokenSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/HttpsTokenSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,55 @@
+ /**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+/**
+ * @author $Author: giger $
+ * @version $Revision: 272 $ $Date: 2010-12-23 14:30:56 +0100 (Thu, 23 Dec 2010) $
+ */
+public class HttpsTokenSecurityEvent extends TokenSecurityEvent {
+
+    public enum AuthenticationType {
+        HttpBasicAuthentication,
+        HttpDigestAuthentication,
+        HttpsClientCertificateAuthentication
+    }
+
+    private AuthenticationType authenticationType;
+    private String issuerName;
+
+    public HttpsTokenSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+
+    public AuthenticationType getAuthenticationType() {
+        return authenticationType;
+    }
+
+    public void setAuthenticationType(AuthenticationType authenticationType) {
+        this.authenticationType = authenticationType;
+    }
+
+    public String getIssuerName() {
+        return issuerName;
+    }
+
+    public void setIssuerName(String issuerName) {
+        this.issuerName = issuerName;
+    }
+}

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/IssuedTokenSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/IssuedTokenSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/IssuedTokenSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/IssuedTokenSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,51 @@
+ /**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+/**
+ * @author $Author: giger $
+ * @version $Revision: 272 $ $Date: 2010-12-23 14:30:56 +0100 (Thu, 23 Dec 2010) $
+ */
+public class IssuedTokenSecurityEvent extends TokenSecurityEvent {
+
+    //todo Use this event. Per spec this could also be a SamlTokenSecurityEvent or a SecurityContextToken
+
+    private boolean internalReference;
+    private String issuerName;
+
+    public IssuedTokenSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+
+    public boolean isInternalReference() {
+        return internalReference;
+    }
+
+    public void setInternalReference(boolean internalReference) {
+        this.internalReference = internalReference;
+    }
+
+    public String getIssuerName() {
+        return issuerName;
+    }
+
+    public void setIssuerName(String issuerName) {
+        this.issuerName = issuerName;
+    }
+}

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/OperationSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/OperationSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/OperationSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/OperationSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author $Author$
+ * @version $Revision$ $Date$
+ */
+public class OperationSecurityEvent extends SecurityEvent {
+
+    private QName operation;
+
+    public OperationSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+
+    public QName getOperation() {
+        return operation;
+    }
+
+    public void setOperation(QName operation) {
+        this.operation = operation;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/OperationSecurityEvent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredElementSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredElementSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredElementSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,43 @@
+ /**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author $Author: giger $
+ * @version $Revision: 272 $ $Date: 2010-12-23 14:30:56 +0100 (Thu, 23 Dec 2010) $
+ */
+public class RequiredElementSecurityEvent extends SecurityEvent {
+
+    //todo xpath or something unique
+    private QName element;
+
+    public RequiredElementSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+
+    public QName getElement() {
+        return element;
+    }
+
+    public void setElement(QName element) {
+        this.element = element;
+    }
+}

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredPartSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredPartSecurityEvent.java?rev=1172285&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredPartSecurityEvent.java (added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/securityEvent/RequiredPartSecurityEvent.java Sun Sep 18 13:51:23 2011
@@ -0,0 +1,43 @@
+ /**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.securityEvent;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author $Author: giger $
+ * @version $Revision: 272 $ $Date: 2010-12-23 14:30:56 +0100 (Thu, 23 Dec 2010) $
+ */
+public class RequiredPartSecurityEvent extends SecurityEvent {
+
+    //todo xpath or something unique
+    private QName element;
+
+    public RequiredPartSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+
+    public QName getElement() {
+        return element;
+    }
+
+    public void setElement(QName element) {
+        this.element = element;
+    }
+}



Mime
View raw message