com.sun.org.apache.xml.internal.security.utils.EncryptionConstants Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.security.utils.EncryptionConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLCipher.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>EncryptedData</code> interface. Use this operation if
 * you want to have full control over the contents of the
 * <code>EncryptedData</code> structure.
 *
 * This does not change the source document in any way.
 *
 * @param context the context <code>Document</code>.
 * @param element the <code>Element</code> that will be encrypted.
 * @param contentMode <code>true</code> to encrypt element's content only,
 *    <code>false</code> otherwise
 * @return the <code>EncryptedData</code>
 * @throws Exception
 */
public EncryptedData encryptData(
    Document context, Element element, boolean contentMode
) throws /* XMLEncryption */ Exception {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Encrypting element...");
    }
    if (null == context) {
        log.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
    }
    if (null == element) {
        log.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
    }
    if (cipherMode != ENCRYPT_MODE && log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
    }

    if (contentMode) {
        return encryptData(context, element, EncryptionConstants.TYPE_CONTENT, null);
    } else {
        return encryptData(context, element, EncryptionConstants.TYPE_ELEMENT, null);
    }
}
 
Example #2
Source File: XMLCipher.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * @param element
 * @return a new EncryptionProperties
 */
EncryptionProperties newEncryptionProperties(Element element) {
    EncryptionProperties result = newEncryptionProperties();

    result.setId(element.getAttributeNS(null, EncryptionConstants._ATT_ID));

    NodeList encryptionPropertyList =
        element.getElementsByTagNameNS(
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTIONPROPERTY);
    for (int i = 0; i < encryptionPropertyList.getLength(); i++) {
        Node n = encryptionPropertyList.item(i);
        if (null != n) {
            result.addEncryptionProperty(newEncryptionProperty((Element) n));
        }
    }

    return result;
}
 
Example #3
Source File: XMLCipher.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>EncryptedData</code> interface. Use this operation if
 * you want to have full control over the contents of the
 * <code>EncryptedData</code> structure.
 *
 * This does not change the source document in any way.
 *
 * @param context the context <code>Document</code>.
 * @param element the <code>Element</code> that will be encrypted.
 * @param contentMode <code>true</code> to encrypt element's content only,
 *    <code>false</code> otherwise
 * @return the <code>EncryptedData</code>
 * @throws Exception
 */
public EncryptedData encryptData(
    Document context, Element element, boolean contentMode
) throws /* XMLEncryption */ Exception {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Encrypting element...");
    }
    if (null == context) {
        log.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
    }
    if (null == element) {
        log.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
    }
    if (cipherMode != ENCRYPT_MODE && log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
    }

    if (contentMode) {
        return encryptData(context, element, EncryptionConstants.TYPE_CONTENT, null);
    } else {
        return encryptData(context, element, EncryptionConstants.TYPE_ELEMENT, null);
    }
}
 
Example #4
Source File: KeyInfo.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Method itemEncryptedKey
 *
 * @param i
 * @return the asked EncryptedKey element, null if the index is too big
 * @throws XMLSecurityException
 */
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
    if (encryptedKeys != null) {
        return encryptedKeys.get(i);
    }
    Element e =
        XMLUtils.selectXencNode(
            this.constructionElement.getFirstChild(), EncryptionConstants._TAG_ENCRYPTEDKEY, i);

    if (e != null) {
        XMLCipher cipher = XMLCipher.getInstance();
        cipher.init(XMLCipher.UNWRAP_MODE, null);
        return cipher.loadEncryptedKey(e);
    }
    return null;
}
 
Example #5
Source File: XMLCipher.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>EncryptedData</code> interface. Use this operation if
 * you want to have full control over the contents of the
 * <code>EncryptedData</code> structure.
 *
 * This does not change the source document in any way.
 *
 * @param context the context <code>Document</code>.
 * @param element the <code>Element</code> that will be encrypted.
 * @param contentMode <code>true</code> to encrypt element's content only,
 *    <code>false</code> otherwise
 * @return the <code>EncryptedData</code>
 * @throws Exception
 */
public EncryptedData encryptData(
    Document context, Element element, boolean contentMode
) throws /* XMLEncryption */ Exception {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Encrypting element...");
    }
    if (null == context) {
        log.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
    }
    if (null == element) {
        log.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
    }
    if (cipherMode != ENCRYPT_MODE && log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
    }

    if (contentMode) {
        return encryptData(context, element, EncryptionConstants.TYPE_CONTENT, null);
    } else {
        return encryptData(context, element, EncryptionConstants.TYPE_ELEMENT, null);
    }
}
 
Example #6
Source File: XMLCipher.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Returns an <code>EncryptedData</code> interface. Use this operation if
 * you want to have full control over the contents of the
 * <code>EncryptedData</code> structure.
 *
 * This does not change the source document in any way.
 *
 * @param context the context <code>Document</code>.
 * @param element the <code>Element</code> that will be encrypted.
 * @param contentMode <code>true</code> to encrypt element's content only,
 *    <code>false</code> otherwise
 * @return the <code>EncryptedData</code>
 * @throws Exception
 */
public EncryptedData encryptData(
    Document context, Element element, boolean contentMode
) throws /* XMLEncryption */ Exception {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Encrypting element...");
    }
    if (null == context) {
        log.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
    }
    if (null == element) {
        log.log(java.util.logging.Level.SEVERE, "Element unexpectedly null...");
    }
    if (cipherMode != ENCRYPT_MODE && log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "XMLCipher unexpectedly not in ENCRYPT_MODE...");
    }

    if (contentMode) {
        return encryptData(context, element, EncryptionConstants.TYPE_CONTENT, null);
    } else {
        return encryptData(context, element, EncryptionConstants.TYPE_ELEMENT, null);
    }
}
 
Example #7
Source File: XMLCipher.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_ENCRYPTIONPROPERTY
        );
    if (null != target) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TARGET, target);
    }
    if (null != id) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, id);
    }
    // TODO: figure out the anyAttribyte stuff...
    // TODO: figure out the any stuff...

    return result;
}
 
Example #8
Source File: XMLCipher.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param element
 * @return a new EncryptionProperties
 */
EncryptionProperties newEncryptionProperties(Element element) {
    EncryptionProperties result = newEncryptionProperties();

    result.setId(element.getAttributeNS(null, EncryptionConstants._ATT_ID));

    NodeList encryptionPropertyList =
        element.getElementsByTagNameNS(
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTIONPROPERTY);
    for (int i = 0; i < encryptionPropertyList.getLength(); i++) {
        Node n = encryptionPropertyList.item(i);
        if (null != n) {
            result.addEncryptionProperty(newEncryptionProperty((Element) n));
        }
    }

    return result;
}
 
Example #9
Source File: KeyInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method itemEncryptedKey
 *
 * @param i
 * @return the asked EncryptedKey element, null if the index is too big
 * @throws XMLSecurityException
 */
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
    if (encryptedKeys != null) {
        return encryptedKeys.get(i);
    }
    Element e =
        XMLUtils.selectXencNode(
            this.constructionElement.getFirstChild(), EncryptionConstants._TAG_ENCRYPTEDKEY, i);

    if (e != null) {
        XMLCipher cipher = XMLCipher.getInstance();
        cipher.init(XMLCipher.UNWRAP_MODE, null);
        return cipher.loadEncryptedKey(e);
    }
    return null;
}
 
Example #10
Source File: XMLCipher.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * @return the XML Element form of that Reference
 */
public Element toElement() {
    String tagName = getType();
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            tagName
        );
    result.setAttribute(EncryptionConstants._ATT_URI, uri);

    // TODO: Need to martial referenceInformation
    // Figure out how to make this work..
    // <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>

    return result;
}
 
Example #11
Source File: KeyInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method itemEncryptedKey
 *
 * @param i
 * @return the asked EncryptedKey element, null if the index is too big
 * @throws XMLSecurityException
 */
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
    if (encryptedKeys != null) {
        return encryptedKeys.get(i);
    }
    Element e =
        XMLUtils.selectXencNode(
            this.constructionElement.getFirstChild(), EncryptionConstants._TAG_ENCRYPTEDKEY, i);

    if (e != null) {
        XMLCipher cipher = XMLCipher.getInstance();
        cipher.init(XMLCipher.UNWRAP_MODE, null);
        return cipher.loadEncryptedKey(e);
    }
    return null;
}
 
Example #12
Source File: KeyInfo.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Method itemEncryptedKey
 *
 * @param i
 * @return the asked EncryptedKey element, null if the index is too big
 * @throws XMLSecurityException
 */
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
    if (encryptedKeys != null) {
        return encryptedKeys.get(i);
    }
    Element e =
        XMLUtils.selectXencNode(
            this.constructionElement.getFirstChild(), EncryptionConstants._TAG_ENCRYPTEDKEY, i);

    if (e != null) {
        XMLCipher cipher = XMLCipher.getInstance();
        cipher.init(XMLCipher.UNWRAP_MODE, null);
        return cipher.loadEncryptedKey(e);
    }
    return null;
}
 
Example #13
Source File: KeyInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method itemEncryptedKey
 *
 * @param i
 * @return the asked EncryptedKey element, null if the index is too big
 * @throws XMLSecurityException
 */
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
    if (encryptedKeys != null) {
        return encryptedKeys.get(i);
    }
    Element e =
        XMLUtils.selectXencNode(
            this.constructionElement.getFirstChild(), EncryptionConstants._TAG_ENCRYPTEDKEY, i);

    if (e != null) {
        XMLCipher cipher = XMLCipher.getInstance();
        cipher.init(XMLCipher.UNWRAP_MODE, null);
        return cipher.loadEncryptedKey(e);
    }
    return null;
}
 
Example #14
Source File: XMLCipher.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_ENCRYPTIONPROPERTY
        );
    if (null != target) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TARGET, target);
    }
    if (null != id) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, id);
    }
    // TODO: figure out the anyAttribyte stuff...
    // TODO: figure out the any stuff...

    return result;
}
 
Example #15
Source File: XMLCipher.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param element
 * @return a new EncryptionProperties
 */
EncryptionProperties newEncryptionProperties(Element element) {
    EncryptionProperties result = newEncryptionProperties();

    result.setId(element.getAttributeNS(null, EncryptionConstants._ATT_ID));

    NodeList encryptionPropertyList =
        element.getElementsByTagNameNS(
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTIONPROPERTY);
    for (int i = 0; i < encryptionPropertyList.getLength(); i++) {
        Node n = encryptionPropertyList.item(i);
        if (null != n) {
            result.addEncryptionProperty(newEncryptionProperty((Element) n));
        }
    }

    return result;
}
 
Example #16
Source File: XMLCipher.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example #17
Source File: XMLCipher.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}
 
Example #18
Source File: XMLCipher.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_CIPHERDATA
        );
    if (cipherType == VALUE_TYPE) {
        result.appendChild(((CipherValueImpl) cipherValue).toElement());
    } else if (cipherType == REFERENCE_TYPE) {
        result.appendChild(((CipherReferenceImpl) cipherReference).toElement());
    }

    return result;
}
 
Example #19
Source File: XMLCipher.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_CIPHERVALUE
        );
    result.appendChild(contextDocument.createTextNode(cipherValue));

    return result;
}
 
Example #20
Source File: XMLCipher.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param element
 * @return a new EncryptionProperty
 */
EncryptionProperty newEncryptionProperty(Element element) {
    EncryptionProperty result = newEncryptionProperty();

    result.setTarget(element.getAttributeNS(null, EncryptionConstants._ATT_TARGET));
    result.setId(element.getAttributeNS(null, EncryptionConstants._ATT_ID));
    // TODO: Make this lot work...
    // <anyAttribute namespace="http://www.w3.org/XML/1998/namespace"/>

    // TODO: Make this work...
    // <any namespace='##other' processContents='lax'/>

    return result;
}
 
Example #21
Source File: XMLCipher.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example #22
Source File: XMLCipher.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_CIPHERREFERENCE
        );
    result.setAttributeNS(null, EncryptionConstants._ATT_URI, referenceURI);
    if (null != referenceTransforms) {
        result.appendChild(((TransformsImpl) referenceTransforms).toElement());
    }

    return result;
}
 
Example #23
Source File: XMLCipher.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_CIPHERREFERENCE
        );
    result.setAttributeNS(null, EncryptionConstants._ATT_URI, referenceURI);
    if (null != referenceTransforms) {
        result.appendChild(((TransformsImpl) referenceTransforms).toElement());
    }

    return result;
}
 
Example #24
Source File: XMLCipher.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example #25
Source File: XMLCipher.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param element
 * @return the <code>Node</code> as a result of the decrypt operation.
 * @throws XMLEncryptionException
 */
private Document decryptElementContent(Element element) throws XMLEncryptionException {
    Element e =
        (Element) element.getElementsByTagNameNS(
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        ).item(0);

    if (null == e) {
        throw new XMLEncryptionException("No EncryptedData child element.");
    }

    return decryptElement(e);
}
 
Example #26
Source File: XMLCipher.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument,
            EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_REFERENCELIST
        );
    Iterator<Reference> eachReference = references.iterator();
    while (eachReference.hasNext()) {
        Reference reference = eachReference.next();
        result.appendChild(((ReferenceImpl) reference).toElement());
    }
    return result;
}
 
Example #27
Source File: XMLCipher.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * @param element
 * @return a new EncryptionProperty
 */
EncryptionProperty newEncryptionProperty(Element element) {
    EncryptionProperty result = newEncryptionProperty();

    result.setTarget(element.getAttributeNS(null, EncryptionConstants._ATT_TARGET));
    result.setId(element.getAttributeNS(null, EncryptionConstants._ATT_ID));
    // TODO: Make this lot work...
    // <anyAttribute namespace="http://www.w3.org/XML/1998/namespace"/>

    // TODO: Make this work...
    // <any namespace='##other' processContents='lax'/>

    return result;
}
 
Example #28
Source File: XMLCipher.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_ENCRYPTIONPROPERTIES
        );
    if (null != id) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, id);
    }
    Iterator<EncryptionProperty> itr = getEncryptionProperties();
    while (itr.hasNext()) {
        result.appendChild(((EncryptionPropertyImpl)itr.next()).toElement());
    }

    return result;
}
 
Example #29
Source File: XMLCipher.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_CIPHERDATA
        );
    if (cipherType == VALUE_TYPE) {
        result.appendChild(((CipherValueImpl) cipherValue).toElement());
    } else if (cipherType == REFERENCE_TYPE) {
        result.appendChild(((CipherReferenceImpl) cipherReference).toElement());
    }

    return result;
}
 
Example #30
Source File: XMLCipher.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
Element toElement() {
    Element result =
        ElementProxy.createElementForFamily(
            contextDocument, EncryptionConstants.EncryptionSpecNS,
            EncryptionConstants._TAG_ENCRYPTEDDATA
        );

    if (null != super.getId()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_ID, super.getId());
    }
    if (null != super.getType()) {
        result.setAttributeNS(null, EncryptionConstants._ATT_TYPE, super.getType());
    }
    if (null != super.getMimeType()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_MIMETYPE, super.getMimeType()
        );
    }
    if (null != super.getEncoding()) {
        result.setAttributeNS(
            null, EncryptionConstants._ATT_ENCODING, super.getEncoding()
        );
    }
    if (null != super.getEncryptionMethod()) {
        result.appendChild(
            ((EncryptionMethodImpl)super.getEncryptionMethod()).toElement()
        );
    }
    if (null != super.getKeyInfo()) {
        result.appendChild(super.getKeyInfo().getElement().cloneNode(true));
    }

    result.appendChild(((CipherDataImpl) super.getCipherData()).toElement());
    if (null != super.getEncryptionProperties()) {
        result.appendChild(((EncryptionPropertiesImpl)
            super.getEncryptionProperties()).toElement());
    }

    return result;
}