Skip navigation links

Oracle Security Developer Tools Web Services Security Java API Reference
11g (11.1.1)

E10678-02


oracle.security.xmlsec.wss.util
Class WSSUtils

java.lang.Object
  extended by oracle.security.xmlsec.wss.util.WSSUtils


public class WSSUtils
extends java.lang.Object

A set of utility methods.


Constructor Summary
WSSUtils()
           

 

Method Summary
static void addWsuIdToElement(java.lang.String id, org.w3c.dom.Element element)
          Adds a wsu:Id attribute to the given element.
static java.lang.String collectTextFromChild(oracle.security.xmlsec.util.XMLElement contextElement, java.lang.String namespaceURI, java.lang.String localName)
          Return the textual content for the text node.
static WSSecurityToken createSecurityToken(org.w3c.dom.Element element)
          Deprecated. Use WSSTokenUtils.createSecurityToken(Element)
static byte[] decodeBinary(java.lang.String encoded, java.lang.String encodingType)
          Decode the previously encoded bytes.
static java.lang.String encodeBinary(byte[] value, java.lang.String encodingType)
          Encode the bytes.
static oracle.security.xmlsec.util.XMLElement getChildElement(oracle.security.xmlsec.util.XMLElement contextElement, java.lang.String nsURI, java.lang.String localName)
          Get the child element.
static java.util.List getChildElements(oracle.security.xmlsec.util.XMLElement contextElement, java.lang.String nsURI, java.lang.String localName)
          Get the child element.
static oracle.security.xmlsec.util.XMLElement getInstance(org.w3c.dom.Element element, java.lang.String tag, java.lang.String ns)
          Creates a new instance of the implementation class for the given tag name, and uses it to wrap the Element.
static java.lang.String getTypeAttribute(org.w3c.dom.Element element, java.lang.String attrName)
          Get the Type attribute.
static org.w3c.dom.Element insertChildElementWithText(oracle.security.xmlsec.util.XMLElement contextElement, java.lang.String namespaceURI, java.lang.String localName, java.lang.String[] namespaceURIs, java.lang.String[] localNames, java.lang.String text, boolean replaceExisting)
          Convert the content string into a text org.w3c.dom.Node and append to the specified org.w3c.dom.Element.
static void prependChild(oracle.security.xmlsec.util.XMLNode parent, org.w3c.dom.Node newChild)
          Prepend the supplied node.
static java.lang.Object resolveReference(oracle.security.xmlsec.dsig.ObjectReference ref, javax.xml.soap.SOAPMessage msg, java.util.Map STRToST)
          Find out what the reference is pointing to by performing all transforms, except the canonicalization ones.
static java.util.List resolveReferences(oracle.security.xmlsec.dsig.XSSignature sig, javax.xml.soap.SOAPMessage msg, java.util.Map STRToST)
          Calls @link #resolveReference(ObjectReference, SOAPMessage, Map) for each references in a signature and puts them into a list
static void setChildElement(oracle.security.xmlsec.util.XMLElement contextElement, oracle.security.xmlsec.util.XMLElement element, java.lang.String[] nsURIs, java.lang.String[] localNames)
          Set the specified element as the child.
static void setTypeAttribute(org.w3c.dom.Element element, java.lang.String attrName, java.lang.String attrVal)
          Set the Type attribute.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

WSSUtils

public WSSUtils()

Method Detail

encodeBinary

public static java.lang.String encodeBinary(byte[] value,
                                            java.lang.String encodingType)
Encode the bytes.
Parameters:
value - The bytes to encode.
encodingType - The URI of the encoding algorithm to use.
Returns:
The encoded content string.

decodeBinary

public static byte[] decodeBinary(java.lang.String encoded,
                                  java.lang.String encodingType)
Decode the previously encoded bytes.
Parameters:
encoded - The bytes to decode.
encodingType - The URI of the encoding algorithm used.
Returns:
The decoded content bytes.

setTypeAttribute

public static void setTypeAttribute(org.w3c.dom.Element element,
                                    java.lang.String attrName,
                                    java.lang.String attrVal)
Set the Type attribute.
Parameters:
element - The parent element of the attribute.
attrName - The name of the attribute.
attrVal - The attribute value.

getTypeAttribute

public static java.lang.String getTypeAttribute(org.w3c.dom.Element element,
                                                java.lang.String attrName)
Get the Type attribute.
Parameters:
element - The parent element of the attribute.
attrName - The name of the attribute.
Returns:
The attribute value string.

insertChildElementWithText

public static org.w3c.dom.Element insertChildElementWithText(oracle.security.xmlsec.util.XMLElement contextElement,
                                                             java.lang.String namespaceURI,
                                                             java.lang.String localName,
                                                             java.lang.String[] namespaceURIs,
                                                             java.lang.String[] localNames,
                                                             java.lang.String text,
                                                             boolean replaceExisting)
                                                      throws org.w3c.dom.DOMException
Convert the content string into a text org.w3c.dom.Node and append to the specified org.w3c.dom.Element.
Parameters:
contextElement - The parent element of the text node to be inserted.
namespaceURI - The namespace of the parent element.
localName -
namespaceURIs - The namespace list corresponding to the list of local names.
localNames - The local name list after which the text node will be inserted.
text - The content string.
replaceExisting - If true, any existing text Node will be replaced.
Returns:
The inserted text org.w3c.dom.Node .
Throws:
org.w3c.dom.DOMException

collectTextFromChild

public static java.lang.String collectTextFromChild(oracle.security.xmlsec.util.XMLElement contextElement,
                                                    java.lang.String namespaceURI,
                                                    java.lang.String localName)
Return the textual content for the text node.
Parameters:
contextElement - The element whose children will be searched for text Nodes.
namespaceURI - The namespace of the child Node.
localName - The tag name of the child Node.
Returns:
The textual content string.

setChildElement

public static void setChildElement(oracle.security.xmlsec.util.XMLElement contextElement,
                                   oracle.security.xmlsec.util.XMLElement element,
                                   java.lang.String[] nsURIs,
                                   java.lang.String[] localNames)
Set the specified element as the child.
Parameters:
contextElement - The parent element.
element - The element that will be added as the child.
nsURIs - The namespace URI list.
localNames - The local name list.

getChildElement

public static oracle.security.xmlsec.util.XMLElement getChildElement(oracle.security.xmlsec.util.XMLElement contextElement,
                                                                     java.lang.String nsURI,
                                                                     java.lang.String localName)
Get the child element.
Parameters:
contextElement - The element whose sub-tree will be searched.
nsURI - The namespace of the child.
localName - The local name of the child.
Returns:
The element.

getChildElements

public static java.util.List getChildElements(oracle.security.xmlsec.util.XMLElement contextElement,
                                              java.lang.String nsURI,
                                              java.lang.String localName)
Get the child element.
Parameters:
contextElement - The element whose sub-tree will be searched.
nsURI - The namespace of the child.
localName - The local name of the child.
Returns:
A list of elements.

getInstance

public static oracle.security.xmlsec.util.XMLElement getInstance(org.w3c.dom.Element element,
                                                                 java.lang.String tag,
                                                                 java.lang.String ns)
Creates a new instance of the implementation class for the given tag name, and uses it to wrap the Element. The namespace is taken from the given Element.
Parameters:
element - The element to be wrapped.
tag - The tag name to look for; if null, the tag will be taken from the element (or its xsi:type attribute).
ns - The namespace in which tag is defined; if null, the namespace will be taken from the element.
Returns:
An instance of a subclass of XMLElement, or null if a corresponding implementation class cannot be identified or instantiated.

prependChild

public static void prependChild(oracle.security.xmlsec.util.XMLNode parent,
                                org.w3c.dom.Node newChild)
Prepend the supplied node.
Parameters:
parent - The parent node.
newChild - The node to prepend.

createSecurityToken

public static WSSecurityToken createSecurityToken(org.w3c.dom.Element element)
                                           throws WSSException
Deprecated. Use WSSTokenUtils.createSecurityToken(Element)
Create a WSSecurityToken from the given org.w3c.dom.Element.
Parameters:
element - A security token that conforms to a supported security token schema.
Returns:
The created security token.
Throws:
WSSException

addWsuIdToElement

public static void addWsuIdToElement(java.lang.String id,
                                     org.w3c.dom.Element element)
Adds a wsu:Id attribute to the given element. If a wsu:Id attribute is already present on the element, its value is changed.
Parameters:
id -
element -

resolveReference

public static java.lang.Object resolveReference(oracle.security.xmlsec.dsig.ObjectReference ref,
                                                javax.xml.soap.SOAPMessage msg,
                                                java.util.Map STRToST)
                                         throws oracle.security.xmlsec.dsig.ReferenceException,
                                                oracle.security.crypto.core.AlgorithmIdentifierException,
                                                oracle.security.xmlsec.transform.TransformationException
Find out what the reference is pointing to by performing all transforms, except the canonicalization ones.

Transforms

Parameters:
ref - the reference to be resolved
msg - the soap messages - only used for resolving cid: references
STRToST - if a non null Map is passed in and if there is an STRTransform this reference's list of transforms, then the STRToST will be filled up a mapping of WSSecurityTokenReference objects to corresponding WSSecurityToken objects. The WSSecurityToken objects are obtained by following the KeyRetrievers
Returns:
  • An AttachmentPart object if it this a cid: reference
  • A byte[] is there a Base64Decode transform
  • A String if this is an external reference (simply returns the URI)
  • A Node if this is an internal reference to single complete subtree.
    This happens when a) ID based referencing is used or b) an XPath filter 2.0 with only one intersect filter that selects a single node is used.
  • A Set containing Nodes , if it an internal reference to anything other than a single complete subtree, i.e. either a single incomplete subtree or multiple subtrees whether complete or incomplete.
    E.g. an XPath Filter 2.0 of type subtract can make a subtree incomplete, and so can an EnvelopedSignatureTransform
Throws:
oracle.security.xmlsec.dsig.ReferenceException - if a reference cannot be resolved, of if the transform has invalid syntax, or if there is
oracle.security.crypto.core.AlgorithmIdentifierException - if there is a unrecognized transform
or if there is any Base64 or XSLT transform,
or if there is any transform following a C14N or STR transform
oracle.security.xmlsec.transform.TransformationException

resolveReferences

public static java.util.List resolveReferences(oracle.security.xmlsec.dsig.XSSignature sig,
                                               javax.xml.soap.SOAPMessage msg,
                                               java.util.Map STRToST)
                                        throws oracle.security.xmlsec.dsig.ReferenceException,
                                               oracle.security.crypto.core.AlgorithmIdentifierException,
                                               oracle.security.xmlsec.transform.TransformationException
Calls @link #resolveReference(ObjectReference, SOAPMessage, Map) for each references in a signature and puts them into a list
Parameters:
sig -
msg -
STRToST -
Returns:
a list of objects
Throws:
oracle.security.xmlsec.dsig.ReferenceException
oracle.security.crypto.core.AlgorithmIdentifierException
oracle.security.xmlsec.transform.TransformationException

Skip navigation links

Oracle Security Developer Tools Web Services Security Java API Reference
11g (11.1.1)

E10678-02


Copyright © 2005, 2009, Oracle. All rights reserved.