All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.idsec.signservice.security.sign.xml.XMLMessageSignatureValidator Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2019-2024 IDsec Solutions AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package se.idsec.signservice.security.sign.xml;

import org.w3c.dom.Document;

import java.security.SignatureException;
import java.security.cert.X509Certificate;
import java.util.List;

/**
 * A validator for validing an XML message that is signed. This is a simpler validator that the
 * {@link XMLSignatureValidator} that can handle signed XML objects containing more than one signature. The
 * {@code XMLMessageSignatureValidator} is intended to be used when verifying the signature on a received XML message.
 *
 * @author Martin Lindström ([email protected])
 * @author Stefan Santesson ([email protected])
 */
public interface XMLMessageSignatureValidator {

  /**
   * Validates the signature on the supplied XML document and asserts that it was signed by any of the supplied
   * certificates.
   * 

* If {@code expectedSignerCertificates} is {@code null} or empty no checking of the signer certificate will be * performed. *

*

* If {@code signatureLocation} is {@code null} and the document contains more than one Signature element the * validation will fail. *

* * @param document the XML document to validate * @param expectedSignerCertificates the expected signer certificates * @param signatureLocation the signature location * @throws SignatureException for validation errors */ void validate(final Document document, final List expectedSignerCertificates, final XMLSignatureLocation signatureLocation) throws SignatureException; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy