XML Security, 1.6

com.ibm.xml.enc.dom
Class DOMEncryptedData

java.lang.Object
  extended by com.ibm.xml.enc.dom.DOMStructure
      extended by com.ibm.xml.enc.dom.DOMEncryptedData
All Implemented Interfaces:
EncryptedData, EncryptedType, XMLStructure

public final class DOMEncryptedData
extends DOMStructure
implements EncryptedData


Field Summary
 
Fields inherited from interface javax.xml.crypto.enc.EncryptedType
CONTENT, ELEMENT, XMLNS
 
Constructor Summary
DOMEncryptedData(org.w3c.dom.Element encDataElem, XMLCryptoContext context)
          Creates a DOMEncryptedData from XML.
DOMEncryptedData(java.lang.String id, java.lang.String type, java.lang.String mimeType, java.lang.String encoding, DOMEncryptionMethod em, DOMKeyInfo ki, DOMCipherData cdata, DOMEncryptionProperties ep, org.w3c.dom.Element localEncDataElem)
           
DOMEncryptedData(ToBeEncrypted toBeEncrypted, DOMEncryptionMethod em, DOMKeyInfo ki, DOMEncryptionProperties eps, java.lang.String id)
          Creates a DOMEncryptedData from the specified components.
DOMEncryptedData(ToBeEncrypted toBeEncrypted, DOMEncryptionMethod em, DOMKeyInfo ki, DOMEncryptionProperties eps, java.lang.String id, DOMCipherReference cipherRef)
          Creates a DOMEncryptedData from the specified components.
 
Method Summary
static java.util.Hashtable collectNamespaceNodesInAncestors(org.w3c.dom.Node startNode, boolean useProxy)
           
static java.util.Hashtable collectXMLPrefixAttributesInAncestors(org.w3c.dom.Node startNode)
           
 java.io.InputStream decrypt(XMLDecryptContext decryptContext)
          Decrypts the CipherData in this EncryptedData.
 void decryptAndReplace(XMLDecryptContext decryptContext)
          Decrypts the CipherData in this EncryptedData and replace the EncryptedData with the decrypted data or element
 void encrypt(XMLEncryptContext encryptContext)
          Encrypts the ToBeEncrypted passed to the construction of this EncryptedType and inserts it in the CipherValue or CipherReference of the CipherData of this EncryptedData.
 boolean equals(java.lang.Object o)
           
 CipherData getCipherData()
          Returns the cipher data containing the encrypted data.
 java.io.InputStream getCipherText()
          Returns the encrypted data if the EncryptedType stores the encrypted data as CipherReference.
 java.lang.String getEncoding()
          Returns a URI identifying the transfer encoding of the data that has been encrypted.
 EncryptionMethod getEncryptionMethod()
          Returns the encryption method applied to the cipher data.
 EncryptionProperties getEncryptionProperties()
          Returns the encryption properties associated with this encrypted type.
 java.lang.String getId()
          Returns the optional ID.
 KeyInfo getKeyInfo()
          Returns the key info that carries information about the key used to encrypt the data.
 java.lang.String getMimeType()
          Returns the mime type of the data that has been encrypted.
 ToBeEncrypted getToBeEncrypted()
          Returns the data to be encrypted if there is any
 java.lang.String getType()
          Returns a URI identifying the type of the plaintext form of the encrypted content.
 void marshal(org.w3c.dom.Node parent, org.w3c.dom.Node nextSibling, java.lang.String encPrefix, DOMCryptoContext context)
           
 void marshal(org.w3c.dom.Node parent, java.lang.String encPrefix, DOMCryptoContext context)
           
(package private) static void serializeNode(org.w3c.dom.Node topNode, org.w3c.dom.Node node, org.w3c.dom.Node exceptedNode, boolean withComments, boolean xmlAttributes, java.io.Writer wr)
           
 
Methods inherited from class com.ibm.xml.enc.dom.DOMStructure
isFeatureSupported
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
 

Constructor Detail

DOMEncryptedData

public DOMEncryptedData(ToBeEncrypted toBeEncrypted,
                        DOMEncryptionMethod em,
                        DOMKeyInfo ki,
                        DOMEncryptionProperties eps,
                        java.lang.String id)
Creates a DOMEncryptedData from the specified components.

Parameters:
em - the EncryptionMethod
ki - the KeyInfo, or null if not specified
eps - the EncryptionProperties or null if not specified.
id - an optional id (specify null to omit)
type - an optional Type (specify null to omit)
mimeType - an optional MimeType (specify null to omit)
encoding - an option Encoding (specify null to omit)

DOMEncryptedData

public DOMEncryptedData(ToBeEncrypted toBeEncrypted,
                        DOMEncryptionMethod em,
                        DOMKeyInfo ki,
                        DOMEncryptionProperties eps,
                        java.lang.String id,
                        DOMCipherReference cipherRef)
Creates a DOMEncryptedData from the specified components.

Parameters:
em - the EncryptionMethod
ki - the KeyInfo, or null if not specified
eps - the EncryptionProperties or null if not specified.
cipherReference - a cipherReference

DOMEncryptedData

public DOMEncryptedData(org.w3c.dom.Element encDataElem,
                        XMLCryptoContext context)
                 throws MarshalException
Creates a DOMEncryptedData from XML.

Parameters:
encDataElem - EncryptedData element
Throws:
MarshalException - if EncryptedData cannot be unmarshalled

DOMEncryptedData

public DOMEncryptedData(java.lang.String id,
                        java.lang.String type,
                        java.lang.String mimeType,
                        java.lang.String encoding,
                        DOMEncryptionMethod em,
                        DOMKeyInfo ki,
                        DOMCipherData cdata,
                        DOMEncryptionProperties ep,
                        org.w3c.dom.Element localEncDataElem)
                 throws MarshalException
Throws:
MarshalException
Method Detail

getId

public java.lang.String getId()
Description copied from interface: EncryptedType
Returns the optional ID.

Specified by:
getId in interface EncryptedType
Returns:
the ID, or null if not specified

getType

public java.lang.String getType()
Description copied from interface: EncryptedType
Returns a URI identifying the type of the plaintext form of the encrypted content.

Specified by:
getType in interface EncryptedType
Returns:
the type, or null if not specified

getMimeType

public java.lang.String getMimeType()
Description copied from interface: EncryptedType
Returns the mime type of the data that has been encrypted.

Specified by:
getMimeType in interface EncryptedType
Returns:
the mime type, or null if not specified

getEncoding

public java.lang.String getEncoding()
Description copied from interface: EncryptedType
Returns a URI identifying the transfer encoding of the data that has been encrypted.

Specified by:
getEncoding in interface EncryptedType
Returns:
the encoding, or null if not specified

getEncryptionMethod

public EncryptionMethod getEncryptionMethod()
Description copied from interface: EncryptedType
Returns the encryption method applied to the cipher data.

Specified by:
getEncryptionMethod in interface EncryptedType
Returns:
the encryption method, or null if not specified

getKeyInfo

public KeyInfo getKeyInfo()
Description copied from interface: EncryptedType
Returns the key info that carries information about the key used to encrypt the data.

Specified by:
getKeyInfo in interface EncryptedType
Returns:
the key info, or null if not specified

getCipherData

public CipherData getCipherData()
Description copied from interface: EncryptedType
Returns the cipher data containing the encrypted data.

Specified by:
getCipherData in interface EncryptedType
Returns:
the cipher data, or null if the data is a CipherValue and the data has not been encrypted yet

getEncryptionProperties

public EncryptionProperties getEncryptionProperties()
Description copied from interface: EncryptedType
Returns the encryption properties associated with this encrypted type.

Specified by:
getEncryptionProperties in interface EncryptedType
Returns:
the encryption properties, or null if not specified

getCipherText

public java.io.InputStream getCipherText()
Returns the encrypted data if the EncryptedType stores the encrypted data as CipherReference.

Specified by:
getCipherText in interface EncryptedType
Returns:
the encrypted data if EncryptedType has CipherReference as CipherData
Throws:
java.lang.IllegalStateException - - if a CipherData is not a CipherReference; or this method is called on a unmarshalled EncryptedType

getToBeEncrypted

public ToBeEncrypted getToBeEncrypted()
Description copied from interface: EncryptedType
Returns the data to be encrypted if there is any

Specified by:
getToBeEncrypted in interface EncryptedType
Returns:
the data to be encrypted if there is any

marshal

public void marshal(org.w3c.dom.Node parent,
                    java.lang.String encPrefix,
                    DOMCryptoContext context)
             throws MarshalException
Specified by:
marshal in class DOMStructure
Throws:
MarshalException

marshal

public void marshal(org.w3c.dom.Node parent,
                    org.w3c.dom.Node nextSibling,
                    java.lang.String encPrefix,
                    DOMCryptoContext context)
             throws MarshalException
Throws:
MarshalException

decryptAndReplace

public void decryptAndReplace(XMLDecryptContext decryptContext)
                       throws XMLEncryptionException
Description copied from interface: EncryptedData
Decrypts the CipherData in this EncryptedData and replace the EncryptedData with the decrypted data or element

Specified by:
decryptAndReplace in interface EncryptedData
Parameters:
decryptContext - the decryption context
Throws:
XMLEncryptionException - if an error occurs while decrypting

decrypt

public java.io.InputStream decrypt(XMLDecryptContext decryptContext)
                            throws XMLEncryptionException
Description copied from interface: EncryptedData
Decrypts the CipherData in this EncryptedData.

Specified by:
decrypt in interface EncryptedData
Specified by:
decrypt in interface EncryptedType
Parameters:
decryptContext - the decryption context
Returns:
the decrypted CipherData as an InputStream.
Throws:
XMLEncryptionException - if an error occurs while decrypting

encrypt

public void encrypt(XMLEncryptContext encryptContext)
             throws MarshalException,
                    XMLEncryptionException
Description copied from interface: EncryptedType
Encrypts the ToBeEncrypted passed to the construction of this EncryptedType and inserts it in the CipherValue or CipherReference of the CipherData of this EncryptedData.

The data is assumed to be serialized by the application before invoking this method.

Specified by:
encrypt in interface EncryptedType
Parameters:
encryptContext - the encryption context
Throws:
MarshalException - if an error occurs while marshalling
XMLEncryptionException - if an error occurs while encrypting

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

serializeNode

static void serializeNode(org.w3c.dom.Node topNode,
                          org.w3c.dom.Node node,
                          org.w3c.dom.Node exceptedNode,
                          boolean withComments,
                          boolean xmlAttributes,
                          java.io.Writer wr)
                   throws java.io.IOException
Throws:
java.io.IOException

collectXMLPrefixAttributesInAncestors

public static java.util.Hashtable collectXMLPrefixAttributesInAncestors(org.w3c.dom.Node startNode)

collectNamespaceNodesInAncestors

public static java.util.Hashtable collectNamespaceNodesInAncestors(org.w3c.dom.Node startNode,
                                                                   boolean useProxy)

XML Security, 1.6

Portions Copyright 2003, 2012 IBM Corporation.
Portions Copyright 2003, 2012 Oracle and/or its affiliates.