EnvelopedSignatureBuilder.java

// @formatter:off

/**
 * DSS - Digital Signature Services
 * Copyright (C) 2015 European Commission, provided under the CEF programme
 * <p>
 * This file is part of the "DSS - Digital Signature Services" project.
 * <p>
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * <p>
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * <p>
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package eu.europa.esig.dss.xades.signature;

import eu.europa.esig.dss.xml.utils.DomUtils;
import eu.europa.esig.dss.model.DSSDocument;
import eu.europa.esig.dss.spi.validation.CertificateVerifier;
import eu.europa.esig.dss.xades.XAdESSignatureParameters;
import org.w3c.dom.Document;

/**
 * This class handles the specifics of the enveloped XML signature
 *
 */
class EnvelopedSignatureBuilder extends XPathPlacementSignatureBuilder {

    /**
     * The default constructor for EnvelopedSignatureBuilder. The enveloped signature uses by default the exclusive
     * method of canonicalization.
     *
     * @param params
     *            The set of parameters relating to the structure and process of the creation or extension of the
     *            electronic signature.
     * @param document
     *            The original document to sign.
     * @param certificateVerifier
     *            {@link CertificateVerifier}
     */
    public EnvelopedSignatureBuilder(final XAdESSignatureParameters params, final DSSDocument document, final CertificateVerifier certificateVerifier) {
        super(params, document, certificateVerifier);
    }

    /**
     * In case of enveloped signature, the document should be the original file. Important for inclusive
     * canonicalization and namespaces
     */
    @Override
    protected Document buildRootDocumentDom() {
        return DomUtils.buildDOM(document);
    }

}