[WSS4J] Suggested patch to promote more flexible sign/encrypt usage cases

"Anderson Jonathan" <anderson_jonathan-Tu/[email protected]> Wed, 4 Feb 2004 18:02:54 -0500
Newsgroups gmane.text.xml.wss4j
Message-ID <[email protected]>
Hey guys,
	WSSignEnvelope, line 257.  Looks as if it attempts to find the element
specified to either be signed or encrypted, and throws an Exception if it
cannot find it.  We've got a portal app that consumes a variety of web
services, and the header information is not uniform across all of the SOAP
messages sent.  Looking for a manner in which I could use WSS4J in a "if
these elements are present, sign them" scenario I made the following *hack*:

if (body == null) {
    /*
    throw new WSSecurityException(
        WSSecurityException.FAILURE,
        "noEncElement",
        new Object[] { nmSpace, elemName });
    */
}
else
{
    transforms = new Transforms(doc);
    transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
    sig.addDocument("#" + setWsuId(body), transforms);
}

It works just great for signing, though I admit I have not a) verified the
signatures yet (still testing) or b) tried this with encryption.  I now
specify multiple elements to sign in the WSDoAllSender signatureParts
parameter, and the handler will sign the elements if they are present.

Thoughts anyone?  Am I digging myself into a hole here, or is this a valid
use case for WSS4J?  Any ideas on what else would need to be modified to
fully support this approach?

Any and all feedback would be appreciated.

	Thanks,
	-Jon




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn