public class WSSMessage {
WSSMessage(String WSSMessage) throws InvalidSOAPMessage {
/*
* The incoming string is supposed to be a valid and well-formed SOAP document.
* If it is not a SOAP document, throw InvalidSOAPMessage exception and return.
* If it is a valid SOAP message, load it into a DOM document.
* The WSSMessage string may or may not contain
* a WSS security header and XMLDS / XENC tags.
* Parse WSS Security header and XMLDS/XENC tags to:
* 1. Load all tokens into a list of Token objects.
* 2. Load all the ds:Signature elements into a list of Signature objects.
* Each Signature object also needs a Token associated with the Signature.
* So detect which Token object corresponds to a Signature object
* and pass on the Token to the Signature constructor.
* 3. Load all the xenc:EncryptedData elements into a list of EncryptedData objects.
* Each EncryptedData object also needs a Token associated with it.
* So detect which Token object corresponds to an Encrypteddata object
* and pass on the Token to the EncryptedData constructor.
*/
}//WSSMessage
public boolean addToken(Token token) {
/*
* Prepend the token to the WSS security header.
*/
}//addToken
public String addId(String XPathExpression, String wsuId) {
/*
* If any of the two parameters of this method is null, return null.
* Apply the XPathExpression XPath filter to the WSS message
* to come up with a single element.
* If the XPath expression results in more than one element, return null.
* Add an attribute named wsu:Id to the element.
* The value of the wsu:Id attribute should be wsuId.
* @ return wsuId.
*/
}//addID
public EncryptedData encryptElement(String wsuElementID,
Token token,
String wsuEncryptedElementID,
String encryptionAlgo) {
/*
* Find the element in the WSS message whose wsu:Id attribute matches with
* wsuElementID.
* XML encrypt the element using encryptionAlgo and key wrapped inside
* the token object.
* @ return the resulting EncryptedData object.
*/
}//encryptElement
public EncryptedData encryptElementWithXPath(String XPathExpression,
Token token,
String wsuEncryptedElementID
String encryptionAlgo) {
/*
* Find an element in the WSS message by applying
* XPathExpression on the WSS message.
* XML encrypt the element using cryptographic algorithm and key wrapped inside
* the token object.
* @ return the resulting EncryptedData object.
*/
}//encryptElementWithXPath
public Signature sign(String wsuElementID,
Token token,
String wsuSignatureID,
String digestAlgo,
String signatureAlgo,
String canonicalizationAlgo) {
/*
* Find the element in the WSS message whose
* wsu:Id attribute matches with wsuElementID.
* XML sign the element using signatureAlgo and key wrapped inside
* the token object.
* Wrap the resulting ds:Signature element in a Signature object.
* @ return the Signature object.
*/
}//sign
public Signature signWithXPath(String XPathExpression,
Token token,
String wsuSignatureID,
String digestAlgo,
String signatureAlgo,
String canonicalizationAlgo) {
/*
* Find an element in the WSS message by applying XPathExpression on the WSS message.
* XML sign the element using cryptographic algorithm and key wrapped inside
* the token object.
* Wrap the resulting ds:Signature element in a Signature object.
* @ return the Signature object.
*/
}//sign
public Token[] getAllTokens() {
/*
* @ return the list of all tokens associated with the message.
*/
}//getAllTokens
public Signature[] getAllSignatures() {
/*
* @ return a list of all signatures associated with this WSS message.
*/
}//getAllSignatures
public EncryptedData[] getAllEncryptedData() {
/*
* @ return a list of all EncryptedData structures associated with this WSS message.
*/
}//EncryptedData()
}//WSSClient