Java Code Examples for com.sun.org.apache.xml.internal.security.utils.XMLUtils#createElementInEncryptionSpace()

The following examples show how to use com.sun.org.apache.xml.internal.security.utils.XMLUtils#createElementInEncryptionSpace() . 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 openjdk-jdk9 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 2
Source File: XMLCipher.java    From jdk8u_jdk 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 3
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 4
Source File: XMLCipher.java    From jdk8u-jdk 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 5
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_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 6
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 =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_CIPHERVALUE
        );
    result.appendChild(contextDocument.createTextNode(cipherValue));

    return result;
}
 
Example 7
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_CIPHERVALUE
        );
    result.appendChild(contextDocument.createTextNode(cipherValue));

    return result;
}
 
Example 8
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_CIPHERREFERENCE
        );
    result.setAttributeNS(null, EncryptionConstants._ATT_URI, referenceURI);
    if (null != referenceTransforms) {
        result.appendChild(((TransformsImpl) referenceTransforms).toElement());
    }

    return result;
}
 
Example 9
Source File: XMLCipher.java    From jdk8u-jdk 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 10
Source File: XMLCipher.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_CIPHERVALUE
        );
    result.appendChild(contextDocument.createTextNode(cipherValue));

    return result;
}
 
Example 11
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_CIPHERDATA
        );
    if (cipherType == VALUE_TYPE) {
        result.appendChild(((CipherValueImpl) cipherValue).toElement());
    } else if (cipherType == REFERENCE_TYPE) {
        result.appendChild(((CipherReferenceImpl) cipherReference).toElement());
    }

    return result;
}
 
Example 12
Source File: XMLCipher.java    From hottub 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 13
Source File: XMLCipher.java    From dragonwell8_jdk 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 14
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_CIPHERREFERENCE
        );
    result.setAttributeNS(null, EncryptionConstants._ATT_URI, referenceURI);
    if (null != referenceTransforms) {
        result.appendChild(((TransformsImpl) referenceTransforms).toElement());
    }

    return result;
}
 
Example 15
Source File: XMLCipher.java    From jdk8u-jdk 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 16
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 17
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_CIPHERVALUE
        );
    result.appendChild(contextDocument.createTextNode(cipherValue));

    return result;
}
 
Example 18
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_CIPHERREFERENCE
        );
    result.setAttributeNS(null, EncryptionConstants._ATT_URI, referenceURI);
    if (null != referenceTransforms) {
        result.appendChild(((TransformsImpl) referenceTransforms).toElement());
    }

    return result;
}
 
Example 19
Source File: XMLCipher.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_ENCRYPTIONMETHOD
        );
    result.setAttributeNS(null, EncryptionConstants._ATT_ALGORITHM, algorithm);
    if (keySize > 0) {
        result.appendChild(
            XMLUtils.createElementInEncryptionSpace(
                contextDocument, EncryptionConstants._TAG_KEYSIZE
        ).appendChild(contextDocument.createTextNode(String.valueOf(keySize))));
    }
    if (null != oaepParams) {
        Element oaepElement =
            XMLUtils.createElementInEncryptionSpace(
                contextDocument, EncryptionConstants._TAG_OAEPPARAMS
            );
        oaepElement.appendChild(contextDocument.createTextNode(Base64.encode(oaepParams)));
        result.appendChild(oaepElement);
    }
    if (digestAlgorithm != null) {
        Element digestElement =
            XMLUtils.createElementInSignatureSpace(contextDocument, Constants._TAG_DIGESTMETHOD);
        digestElement.setAttributeNS(null, "Algorithm", digestAlgorithm);
        result.appendChild(digestElement);
    }
    if (mgfAlgorithm != null) {
        Element mgfElement =
            XMLUtils.createElementInEncryption11Space(
                contextDocument, EncryptionConstants._TAG_MGF
            );
        mgfElement.setAttributeNS(null, "Algorithm", mgfAlgorithm);
        mgfElement.setAttributeNS(
            Constants.NamespaceSpecNS,
            "xmlns:" + ElementProxy.getDefaultPrefix(EncryptionConstants.EncryptionSpec11NS),
            EncryptionConstants.EncryptionSpec11NS
        );
        result.appendChild(mgfElement);
    }
    Iterator<Element> itr = encryptionMethodInformation.iterator();
    while (itr.hasNext()) {
        result.appendChild(itr.next());
    }

    return result;
}
 
Example 20
Source File: XMLCipher.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
Element toElement() {
    Element result =
        XMLUtils.createElementInEncryptionSpace(
            contextDocument, EncryptionConstants._TAG_ENCRYPTIONMETHOD
        );
    result.setAttributeNS(null, EncryptionConstants._ATT_ALGORITHM, algorithm);
    if (keySize > 0) {
        result.appendChild(
            XMLUtils.createElementInEncryptionSpace(
                contextDocument, EncryptionConstants._TAG_KEYSIZE
        ).appendChild(contextDocument.createTextNode(String.valueOf(keySize))));
    }
    if (null != oaepParams) {
        Element oaepElement =
            XMLUtils.createElementInEncryptionSpace(
                contextDocument, EncryptionConstants._TAG_OAEPPARAMS
            );
        oaepElement.appendChild(contextDocument.createTextNode(Base64.encode(oaepParams)));
        result.appendChild(oaepElement);
    }
    if (digestAlgorithm != null) {
        Element digestElement =
            XMLUtils.createElementInSignatureSpace(contextDocument, Constants._TAG_DIGESTMETHOD);
        digestElement.setAttributeNS(null, "Algorithm", digestAlgorithm);
        result.appendChild(digestElement);
    }
    if (mgfAlgorithm != null) {
        Element mgfElement =
            XMLUtils.createElementInEncryption11Space(
                contextDocument, EncryptionConstants._TAG_MGF
            );
        mgfElement.setAttributeNS(null, "Algorithm", mgfAlgorithm);
        mgfElement.setAttributeNS(
            Constants.NamespaceSpecNS,
            "xmlns:" + ElementProxy.getDefaultPrefix(EncryptionConstants.EncryptionSpec11NS),
            EncryptionConstants.EncryptionSpec11NS
        );
        result.appendChild(mgfElement);
    }
    Iterator<Element> itr = encryptionMethodInformation.iterator();
    while (itr.hasNext()) {
        result.appendChild(itr.next());
    }

    return result;
}