com.rsa.swsj
Class XMLSecurityOperation

java.lang.Object
  extended bycom.rsa.swsj.XMLSecurityOperation
Direct Known Subclasses:
XMLEncryption, XMLSignature

public abstract class XMLSecurityOperation
extends java.lang.Object

This class is a superclass for all XML Security operations, XMLSignature and XMLEncryption. It contains information that is common for all security operations, such as security parameters, references, and status of the operation.


Constructor Summary
XMLSecurityOperation()

 

 
Method Summary

 void

addReference(Reference reference)

Adds a Reference.

 SWSJContext

getContext()

Gets the SWSJContext that is used to carry a number of common parameters and state variables; for example, JCE provider.

 java.lang.String

getId()

Gets the Id attribute that provides a standard method to assign a string ID to an element within the document context.

 java.lang.String

getNamespacePrefix()

Gets the XML prefix of the XMLSecurityOperation element as a String object.

 java.io.OutputStream

getOutputStream()

Returns the output stream for operation results.

 SecurityParameters

getParameters()

Gets the SecurityParameters object of this XMLSecurityOperation object.

 Reference[]

getReferences()

Returns an array of references.

 StatusInfo

getStatusInfo()

Gets the object that contains the status of this operation.

 Timestamp

getTimestamp()

Gets the timestamp object associated with this security operation.

abstract  int

getType()

Gets the signature type as an integer value.

 void

setExpirationTime(java.util.Calendar time)

Sets the expiration time for this security operation.

 void

setId(java.lang.String id)

Sets the Id attribute that provides a standard method to assign a string ID to an element within the document context.

 void

setLocation(java.lang.String qName, int count)

Sets the location where this security operation is inserted.

 void

setNamespacePrefix(java.lang.String prefix)

Sets the XML prefix of this XMLSecurityOperation element to prefix.

 void

setOutputStream(java.io.OutputStream outputStream)

Sets output stream for results of the operation.

 void

setParameters(SecurityParameters params)

Sets the parameters of this XMLSecurityOperation to the parameters contained in params.

 void

setReferences(Reference[] references)

Sets the array of references.

abstract  void

setType(int type)

Sets the type of the specific Security Operation.

 void

skip()

Skips processing of this operation.

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

Constructor Detail

XMLSecurityOperation

public XMLSecurityOperation()
Method Detail

setReferences

public void setReferences(Reference[] references)
                   throws InvalidParameterException
Sets the array of references. Any previously existing references are overwritten.

Note: References for XMLSignature operations must be a SigReference object. References for XMLEncryption operations must be a Reference object.

Parameters:
references - An array of references.
Throws:
InvalidParameterException - If any of the references is null.

addReference

public void addReference(Reference reference)
                  throws InvalidParameterException
Adds a Reference.

Note: References for XMLSignature operations must be a SigReference object. References for XMLEncryption operations must be a Reference object.

Parameters:
reference - The reference to add.
Throws:
InvalidParameterException - If the reference is null.

getReferences

public Reference[] getReferences()
Returns an array of references.

Note: References for XMLSignature operations are SigReference objects. References for XMLEncryption operations are Reference objects.

Returns:
The array of references.

setParameters

public void setParameters(SecurityParameters params)
Sets the parameters of this XMLSecurityOperation to the parameters contained in params.

Parameters:
params - A SecurityParameters object that contains a list of parameters required by this security operation.

getParameters

public SecurityParameters getParameters()
Gets the SecurityParameters object of this XMLSecurityOperation object. The SecurityParameters object can contain keys, names, certificates, and other public key management information, such as in-band key distribution or key-agreement data.

Returns:
A SecurityParameters object.

getContext

public SWSJContext getContext()
Gets the SWSJContext that is used to carry a number of common parameters and state variables; for example, JCE provider.

Returns:
The SWSJContext object.

getStatusInfo

public StatusInfo getStatusInfo()
Gets the object that contains the status of this operation. Note: Process the document before getting the status information.

Returns:
The StatusInfo object of this XML security operation.

setOutputStream

public void setOutputStream(java.io.OutputStream outputStream)
Sets output stream for results of the operation. It has to be different from the output stream set in XMLDocument.

Parameters:
outputStream - An OutputStream object.

getOutputStream

public java.io.OutputStream getOutputStream()
Returns the output stream for operation results.

Returns:
The OutputStream object.

skip

public void skip()
Skips processing of this operation. This operation does not report any errors.


setNamespacePrefix

public void setNamespacePrefix(java.lang.String prefix)
Sets the XML prefix of this XMLSecurityOperation element to prefix.

Parameters:
prefix - A String holding the XML prefix to set.

getNamespacePrefix

public java.lang.String getNamespacePrefix()
Gets the XML prefix of the XMLSecurityOperation element as a String object.

Returns:
The prefix of this XMLSecurityOperation element as a String object.

setType

public abstract void setType(int type)
                      throws InvalidParameterException
Sets the type of the specific Security Operation.

Note: See a specific security operation such as signing or encryption for more detail.

Parameters:
type - An integer containing the type.
Throws:
InvalidParameterException

getType

public abstract int getType()
Gets the signature type as an integer value.

Note: See specific security operations, such as signature and encryption, for more detail.

Returns:
The integer value representing the operation type.

setId

public void setId(java.lang.String id)
Sets the Id attribute that provides a standard method to assign a string ID to an element within the document context.

Note: It is the user's responsibility not to duplicate ID values in XML and WSS documents to which security will be added.

Parameters:
id - The ID.

getId

public java.lang.String getId()
Gets the Id attribute that provides a standard method to assign a string ID to an element within the document context.

Returns:
The Id attribute.

setLocation

public void setLocation(java.lang.String qName,
                        int count)
                 throws ParseException
Sets the location where this security operation is inserted.

Note: In an XMLSignature security operation, a Signature node is added. In an XMLEncryption security operation, an EncryptedKey node is added. This method specifies the location of either type of node.

Parameters:
qName - The qualified name (with prefix) that identifies the Target Node, or an empty string, if qualified names are not available.

count - Specifies which occurance of the node after which the security operation is inserted. If not specified, a value of 1 is the default. If the qname is not set, then count indicates the index of the target node in a preorder traversal of the document tree.

Throws:
ParseException - If the specified node does not exist.

setExpirationTime

public void setExpirationTime(java.util.Calendar time)
                       throws InvalidParameterException
Sets the expiration time for this security operation.

Parameters:
time - A Calendar object that indicates the expiration time for this security operation.
Throws:
InvalidParameterException - If an invalid value is set.

getTimestamp

public Timestamp getTimestamp()
Gets the timestamp object associated with this security operation.

Returns:
The Timestamp object.