Java Code Examples for javax.xml.crypto.dom.DOMCryptoContext

The following examples show how to use javax.xml.crypto.dom.DOMCryptoContext. These examples are extracted from open source projects. 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
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    ownerDoc = DOMUtils.getOwnerDocument(parent);
    Element siElem = DOMUtils.createElement(ownerDoc, "SignedInfo",
                                            XMLSignature.XMLNS, dsPrefix);

    // create and append CanonicalizationMethod element
    DOMCanonicalizationMethod dcm =
        (DOMCanonicalizationMethod)canonicalizationMethod;
    dcm.marshal(siElem, dsPrefix, context);

    // create and append SignatureMethod element
    ((DOMStructure)signatureMethod).marshal(siElem, dsPrefix, context);

    // create and append Reference elements
    for (Reference reference : references) {
        ((DOMReference)reference).marshal(siElem, dsPrefix, context);
    }

    // append Id attribute
    DOMUtils.setAttributeID(siElem, "Id", id);

    parent.appendChild(siElem);
    localSiElem = siElem;
}
 
Example 2
public void init(XMLStructure parent, XMLCryptoContext context)
    throws InvalidAlgorithmParameterException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure) parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 3
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure) parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 4
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);
    Element propElem = DOMUtils.createElement(ownerDoc, "SignatureProperty",
                                              XMLSignature.XMLNS, dsPrefix);

    // set attributes
    DOMUtils.setAttributeID(propElem, "Id", id);
    DOMUtils.setAttribute(propElem, "Target", target);

    // create and append any elements and mixed content
    for (XMLStructure property : content) {
        DOMUtils.appendChild(propElem,
            ((javax.xml.crypto.dom.DOMStructure)property).getNode());
    }

    parent.appendChild(propElem);
}
 
Example 5
/**
 * This method invokes the abstract {@link #marshalParams marshalParams}
 * method to marshal any algorithm-specific parameters.
 */
public void marshal(Node parent, String prefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element dmElem = DOMUtils.createElement(ownerDoc, "DigestMethod",
                                            XMLSignature.XMLNS, prefix);
    DOMUtils.setAttribute(dmElem, "Algorithm", getAlgorithm());

    if (params != null) {
        marshalParams(dmElem, prefix);
    }

    parent.appendChild(dmElem);
}
 
Example 6
/**
 * This method invokes the abstract {@link #marshalParams marshalParams}
 * method to marshal any algorithm-specific parameters.
 */
public void marshal(Node parent, String prefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element dmElem = DOMUtils.createElement(ownerDoc, "DigestMethod",
                                            XMLSignature.XMLNS, prefix);
    DOMUtils.setAttribute(dmElem, "Algorithm", getAlgorithm());

    if (params != null) {
        marshalParams(dmElem, prefix);
    }

    parent.appendChild(dmElem);
}
 
Example 7
public void init(XMLStructure parent, XMLCryptoContext context)
    throws InvalidAlgorithmParameterException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure) parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 8
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element isElem = DOMUtils.createElement(ownerDoc, "X509IssuerSerial",
                                            XMLSignature.XMLNS, dsPrefix);
    Element inElem = DOMUtils.createElement(ownerDoc, "X509IssuerName",
                                            XMLSignature.XMLNS, dsPrefix);
    Element snElem = DOMUtils.createElement(ownerDoc, "X509SerialNumber",
                                            XMLSignature.XMLNS, dsPrefix);
    inElem.appendChild(ownerDoc.createTextNode(issuerName));
    snElem.appendChild(ownerDoc.createTextNode(serialNumber.toString()));
    isElem.appendChild(inElem);
    isElem.appendChild(snElem);
    parent.appendChild(isElem);
}
 
Example 9
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure)parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 10
Source Project: dragonwell8_jdk   Source File: DOMTransform.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method invokes the abstract {@link #marshalParams marshalParams}
 * method to marshal any algorithm-specific parameters.
 */
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element transformElem = null;
    if (parent.getLocalName().equals("Transforms")) {
        transformElem = DOMUtils.createElement(ownerDoc, "Transform",
                                               XMLSignature.XMLNS,
                                               dsPrefix);
    } else {
        transformElem = DOMUtils.createElement(ownerDoc,
                                               "CanonicalizationMethod",
                                               XMLSignature.XMLNS,
                                               dsPrefix);
    }
    DOMUtils.setAttribute(transformElem, "Algorithm", getAlgorithm());

    spi.marshalParams(new javax.xml.crypto.dom.DOMStructure(transformElem),
                      context);

    parent.appendChild(transformElem);
}
 
Example 11
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element isElem = DOMUtils.createElement(ownerDoc, "X509IssuerSerial",
                                            XMLSignature.XMLNS, dsPrefix);
    Element inElem = DOMUtils.createElement(ownerDoc, "X509IssuerName",
                                            XMLSignature.XMLNS, dsPrefix);
    Element snElem = DOMUtils.createElement(ownerDoc, "X509SerialNumber",
                                            XMLSignature.XMLNS, dsPrefix);
    inElem.appendChild(ownerDoc.createTextNode(issuerName));
    snElem.appendChild(ownerDoc.createTextNode(serialNumber.toString()));
    isElem.appendChild(inElem);
    isElem.appendChild(snElem);
    parent.appendChild(isElem);
}
 
Example 12
Source Project: dragonwell8_jdk   Source File: DOMKeyValue.java    License: GNU General Public License v2.0 6 votes vote down vote up
void marshalPublicKey(Node parent, Document doc, String dsPrefix,
    DOMCryptoContext context) throws MarshalException {
    Element rsaElem = DOMUtils.createElement(doc, "RSAKeyValue",
                                             XMLSignature.XMLNS,
                                             dsPrefix);
    Element modulusElem = DOMUtils.createElement(doc, "Modulus",
                                                 XMLSignature.XMLNS,
                                                 dsPrefix);
    Element exponentElem = DOMUtils.createElement(doc, "Exponent",
                                                  XMLSignature.XMLNS,
                                                  dsPrefix);
    modulus.marshal(modulusElem, dsPrefix, context);
    exponent.marshal(exponentElem, dsPrefix, context);
    rsaElem.appendChild(modulusElem);
    rsaElem.appendChild(exponentElem);
    parent.appendChild(rsaElem);
}
 
Example 13
Source Project: dragonwell8_jdk   Source File: DOMKeyValue.java    License: GNU General Public License v2.0 6 votes vote down vote up
void marshalPublicKey(Node parent, Document doc, String dsPrefix,
                      DOMCryptoContext context)
    throws MarshalException
{
    Element dsaElem = DOMUtils.createElement(doc, "DSAKeyValue",
                                             XMLSignature.XMLNS,
                                             dsPrefix);
    // parameters J, Seed & PgenCounter are not included
    Element pElem = DOMUtils.createElement(doc, "P", XMLSignature.XMLNS,
                                           dsPrefix);
    Element qElem = DOMUtils.createElement(doc, "Q", XMLSignature.XMLNS,
                                           dsPrefix);
    Element gElem = DOMUtils.createElement(doc, "G", XMLSignature.XMLNS,
                                           dsPrefix);
    Element yElem = DOMUtils.createElement(doc, "Y", XMLSignature.XMLNS,
                                           dsPrefix);
    p.marshal(pElem, dsPrefix, context);
    q.marshal(qElem, dsPrefix, context);
    g.marshal(gElem, dsPrefix, context);
    y.marshal(yElem, dsPrefix, context);
    dsaElem.appendChild(pElem);
    dsaElem.appendChild(qElem);
    dsaElem.appendChild(gElem);
    dsaElem.appendChild(yElem);
    parent.appendChild(dsaElem);
}
 
Example 14
Source Project: TencentKona-8   Source File: DOMSignedInfo.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    ownerDoc = DOMUtils.getOwnerDocument(parent);
    Element siElem = DOMUtils.createElement(ownerDoc, "SignedInfo",
                                            XMLSignature.XMLNS, dsPrefix);

    // create and append CanonicalizationMethod element
    DOMCanonicalizationMethod dcm =
        (DOMCanonicalizationMethod)canonicalizationMethod;
    dcm.marshal(siElem, dsPrefix, context);

    // create and append SignatureMethod element
    ((DOMStructure)signatureMethod).marshal(siElem, dsPrefix, context);

    // create and append Reference elements
    for (Reference reference : references) {
        ((DOMReference)reference).marshal(siElem, dsPrefix, context);
    }

    // append Id attribute
    DOMUtils.setAttributeID(siElem, "Id", id);

    parent.appendChild(siElem);
    localSiElem = siElem;
}
 
Example 15
public void init(XMLStructure parent, XMLCryptoContext context)
    throws InvalidAlgorithmParameterException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure) parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 16
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure) parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 17
Source Project: openjdk-jdk8u   Source File: DOMKeyValue.java    License: GNU General Public License v2.0 6 votes vote down vote up
void marshalPublicKey(Node parent, Document doc, String dsPrefix,
    DOMCryptoContext context) throws MarshalException {
    Element rsaElem = DOMUtils.createElement(doc, "RSAKeyValue",
                                             XMLSignature.XMLNS,
                                             dsPrefix);
    Element modulusElem = DOMUtils.createElement(doc, "Modulus",
                                                 XMLSignature.XMLNS,
                                                 dsPrefix);
    Element exponentElem = DOMUtils.createElement(doc, "Exponent",
                                                  XMLSignature.XMLNS,
                                                  dsPrefix);
    modulus.marshal(modulusElem, dsPrefix, context);
    exponent.marshal(exponentElem, dsPrefix, context);
    rsaElem.appendChild(modulusElem);
    rsaElem.appendChild(exponentElem);
    parent.appendChild(rsaElem);
}
 
Example 18
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);
    Element propElem = DOMUtils.createElement(ownerDoc, "SignatureProperty",
                                              XMLSignature.XMLNS, dsPrefix);

    // set attributes
    DOMUtils.setAttributeID(propElem, "Id", id);
    DOMUtils.setAttribute(propElem, "Target", target);

    // create and append any elements and mixed content
    for (XMLStructure property : content) {
        DOMUtils.appendChild(propElem,
            ((javax.xml.crypto.dom.DOMStructure)property).getNode());
    }

    parent.appendChild(propElem);
}
 
Example 19
/**
 * This method invokes the abstract {@link #marshalParams marshalParams}
 * method to marshal any algorithm-specific parameters.
 */
public void marshal(Node parent, String prefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element dmElem = DOMUtils.createElement(ownerDoc, "DigestMethod",
                                            XMLSignature.XMLNS, prefix);
    DOMUtils.setAttribute(dmElem, "Algorithm", getAlgorithm());

    if (params != null) {
        marshalParams(dmElem, prefix);
    }

    parent.appendChild(dmElem);
}
 
Example 20
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure) parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 21
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);
    Element propsElem = DOMUtils.createElement(ownerDoc,
                                               "SignatureProperties",
                                               XMLSignature.XMLNS,
                                               dsPrefix);

    // set attributes
    DOMUtils.setAttributeID(propsElem, "Id", id);

    // create and append any properties
    for (SignatureProperty property : properties) {
        ((DOMSignatureProperty)property).marshal(propsElem, dsPrefix,
                                                 context);
    }

    parent.appendChild(propsElem);
}
 
Example 22
public void init(XMLStructure parent, XMLCryptoContext context)
    throws InvalidAlgorithmParameterException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure)parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 23
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
    throws MarshalException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure)parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
 
Example 24
Source Project: TencentKona-8   Source File: DOMTransform.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method invokes the abstract {@link #marshalParams marshalParams}
 * method to marshal any algorithm-specific parameters.
 */
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element transformElem = null;
    if (parent.getLocalName().equals("Transforms")) {
        transformElem = DOMUtils.createElement(ownerDoc, "Transform",
                                               XMLSignature.XMLNS,
                                               dsPrefix);
    } else {
        transformElem = DOMUtils.createElement(ownerDoc,
                                               "CanonicalizationMethod",
                                               XMLSignature.XMLNS,
                                               dsPrefix);
    }
    DOMUtils.setAttribute(transformElem, "Algorithm", getAlgorithm());

    spi.marshalParams(new javax.xml.crypto.dom.DOMStructure(transformElem),
                      context);

    parent.appendChild(transformElem);
}
 
Example 25
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element isElem = DOMUtils.createElement(ownerDoc, "X509IssuerSerial",
                                            XMLSignature.XMLNS, dsPrefix);
    Element inElem = DOMUtils.createElement(ownerDoc, "X509IssuerName",
                                            XMLSignature.XMLNS, dsPrefix);
    Element snElem = DOMUtils.createElement(ownerDoc, "X509SerialNumber",
                                            XMLSignature.XMLNS, dsPrefix);
    inElem.appendChild(ownerDoc.createTextNode(issuerName));
    snElem.appendChild(ownerDoc.createTextNode(serialNumber.toString()));
    isElem.appendChild(inElem);
    isElem.appendChild(snElem);
    parent.appendChild(isElem);
}
 
Example 26
Source Project: TencentKona-8   Source File: DOMKeyValue.java    License: GNU General Public License v2.0 6 votes vote down vote up
void marshalPublicKey(Node parent, Document doc, String dsPrefix,
    DOMCryptoContext context) throws MarshalException {
    Element rsaElem = DOMUtils.createElement(doc, "RSAKeyValue",
                                             XMLSignature.XMLNS,
                                             dsPrefix);
    Element modulusElem = DOMUtils.createElement(doc, "Modulus",
                                                 XMLSignature.XMLNS,
                                                 dsPrefix);
    Element exponentElem = DOMUtils.createElement(doc, "Exponent",
                                                  XMLSignature.XMLNS,
                                                  dsPrefix);
    modulus.marshal(modulusElem, dsPrefix, context);
    exponent.marshal(exponentElem, dsPrefix, context);
    rsaElem.appendChild(modulusElem);
    rsaElem.appendChild(exponentElem);
    parent.appendChild(rsaElem);
}
 
Example 27
Source Project: TencentKona-8   Source File: DOMKeyValue.java    License: GNU General Public License v2.0 6 votes vote down vote up
void marshalPublicKey(Node parent, Document doc, String dsPrefix,
                      DOMCryptoContext context)
    throws MarshalException
{
    Element dsaElem = DOMUtils.createElement(doc, "DSAKeyValue",
                                             XMLSignature.XMLNS,
                                             dsPrefix);
    // parameters J, Seed & PgenCounter are not included
    Element pElem = DOMUtils.createElement(doc, "P", XMLSignature.XMLNS,
                                           dsPrefix);
    Element qElem = DOMUtils.createElement(doc, "Q", XMLSignature.XMLNS,
                                           dsPrefix);
    Element gElem = DOMUtils.createElement(doc, "G", XMLSignature.XMLNS,
                                           dsPrefix);
    Element yElem = DOMUtils.createElement(doc, "Y", XMLSignature.XMLNS,
                                           dsPrefix);
    p.marshal(pElem, dsPrefix, context);
    q.marshal(qElem, dsPrefix, context);
    g.marshal(gElem, dsPrefix, context);
    y.marshal(yElem, dsPrefix, context);
    dsaElem.appendChild(pElem);
    dsaElem.appendChild(qElem);
    dsaElem.appendChild(gElem);
    dsaElem.appendChild(yElem);
    parent.appendChild(dsaElem);
}
 
Example 28
/**
 * This method invokes the {@link #marshalParams marshalParams}
 * method to marshal any algorithm-specific parameters.
 */
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    Document ownerDoc = DOMUtils.getOwnerDocument(parent);

    Element smElem = DOMUtils.createElement(ownerDoc, "SignatureMethod",
                                            XMLSignature.XMLNS, dsPrefix);
    DOMUtils.setAttribute(smElem, "Algorithm", getAlgorithm());

    if (getParameterSpec() != null) {
        marshalParams(smElem, dsPrefix);
    }

    parent.appendChild(smElem);
}
 
Example 29
Source Project: jdk8u60   Source File: DOMSignedInfo.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
    throws MarshalException
{
    ownerDoc = DOMUtils.getOwnerDocument(parent);
    Element siElem = DOMUtils.createElement(ownerDoc, "SignedInfo",
                                            XMLSignature.XMLNS, dsPrefix);

    // create and append CanonicalizationMethod element
    DOMCanonicalizationMethod dcm =
        (DOMCanonicalizationMethod)canonicalizationMethod;
    dcm.marshal(siElem, dsPrefix, context);

    // create and append SignatureMethod element
    ((DOMStructure)signatureMethod).marshal(siElem, dsPrefix, context);

    // create and append Reference elements
    for (Reference reference : references) {
        ((DOMReference)reference).marshal(siElem, dsPrefix, context);
    }

    // append Id attribute
    DOMUtils.setAttributeID(siElem, "Id", id);

    parent.appendChild(siElem);
    localSiElem = siElem;
}
 
Example 30
Source Project: jdk8u60   Source File: ApacheTransform.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void init(XMLStructure parent, XMLCryptoContext context)
    throws InvalidAlgorithmParameterException
{
    if (context != null && !(context instanceof DOMCryptoContext)) {
        throw new ClassCastException
            ("context must be of type DOMCryptoContext");
    }
    if (parent == null) {
        throw new NullPointerException();
    }
    if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
        throw new ClassCastException("parent must be of type DOMStructure");
    }
    transformElem = (Element)
        ((javax.xml.crypto.dom.DOMStructure) parent).getNode();
    ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}