title: Validate XADES signature with XADES4j
body: <p>We would like to create a java web application which verify "XADES" signature, this application should take two files : the original file and his detached signature.</p>
  
  <p>I'm using the XADES4j library which is great project. with XADES4j is there a way to verify signature without verifying the  Reference for URI file ? because the given reference File in xml signature could not  be accessible.</p>
  
  <p>For reference validation : I'm looking to compare the digest Value calculated  from the given orignal file and the digestValue extracted from the signature file.</p>
  
  <p>Here is the exception </p>
  
  <pre><code>Exception in thread "main" xades4j.XAdES4jXMLSigException: Error verifying the signature
      at xades4j.verification.XadesVerifierImpl.doCoreVerification(XadesVerifierImpl.java:285)
      at xades4j.verification.XadesVerifierImpl.verify(XadesVerifierImpl.java:188)
      at com.wct.VerifyXades.main(VerifyXades.java:33)
  Caused by: org.apache.xml.security.signature.MissingResourceFailureException: The Reference for URI file:/D:/workspace/xades4j-487d7a9bb9e5/data_to_sign/test.txt has no XMLSignatureInput
  Original Exception was org.apache.xml.security.signature.ReferenceNotInitializedException: D:\workspace\xades4j-487d7a9bb9e5\data_to_sign\test.txt (Le fichier spécifié est introuvable)
  Original Exception was org.apache.xml.security.signature.ReferenceNotInitializedException: D:\workspace\xades4j-487d7a9bb9e5\data_to_sign\test.txt (Le fichier spécifié est introuvable)
  Original Exception was org.apache.xml.security.signature.ReferenceNotInitializedException: D:\workspace\xades4j-487d7a9bb9e5\data_to_sign\test.txt (Le fichier spécifié est introuvable)
  Original Exception was org.apache.xml.security.utils.resolver.ResourceResolverException: D:\workspace\xades4j-487d7a9bb9e5\data_to_sign\test.txt (Le fichier spécifié est introuvable)
  Original Exception was java.io.FileNotFoundException: D:\workspace\xades4j-487d7a9bb9e5\data_to_sign\test.txt (Le fichier spécifié est introuvable)
      at org.apache.xml.security.signature.Manifest.verifyReferences(Manifest.java:412)
      at org.apache.xml.security.signature.SignedInfo.verify(SignedInfo.java:256)
      at org.apache.xml.security.signature.XMLSignature.checkSignatureValue(XMLSignature.java:764)
      at org.apache.xml.security.signature.XMLSignature.checkSignatureValue(XMLSignature.java:696)
      at xades4j.verification.XadesVerifierImpl.doCoreVerification(XadesVerifierImpl.java:278)
      ... 2 more
  </code></pre>
  
  <p>Here is  the source code i am using to verify XADES signature :</p>
  
  <pre><code>package com.wct;
  
  import java.io.FileInputStream;
  import java.security.cert.X509CertSelector;
  import java.security.cert.X509Certificate;
  import java.util.Collection;
  import java.util.Date;
  import java.util.List;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import org.w3c.dom.Document;
  import xades4j.providers.CertificateValidationException;
  import xades4j.providers.CertificateValidationProvider;
  import xades4j.providers.ValidationData;
  import xades4j.verification.UnexpectedJCAException;
  import xades4j.verification.XAdESVerificationResult;
  import xades4j.verification.XadesVerificationProfile;
  import xades4j.verification.XadesVerifier;
  
  public class VerifyXades {
  
      public static void main(String[] args) throws Exception {
          CertificateValidationProvider certValidator = new CertificateValidationProviderImpl();
          XadesVerificationProfile p = new XadesVerificationProfile(certValidator);
          p.acceptUnknownProperties(true);
          XadesVerifier v = p.newVerifier();
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
          dbf.setNamespaceAware(true);
          DocumentBuilder db = dbf.newDocumentBuilder();
          Document doc = db.parse(new FileInputStream("data_signed/detachedTestSignature.xml"));
          XAdESVerificationResult vr = v.verify(doc.getDocumentElement(), null);
      }
  }
  
  class CertificateValidationProviderImpl implements CertificateValidationProvider {
      @Override
      public ValidationData validate(X509CertSelector certSelector,
              Date validationDate, Collection&lt;X509Certificate&gt; otherCerts)
              throws CertificateValidationException, UnexpectedJCAException {
          return new ValidationData((List&lt;X509Certificate&gt;) otherCerts);
      }
  }
  </code></pre>
  
  <p>I am new in signature/verify development and i have not good experience. please help</p>
  
  <p>Thanks in advance for your helps </p>