makdimka077 / xades4j

Automatically exported from code.google.com/p/xades4j
GNU Lesser General Public License v3.0
0 stars 0 forks source link

verify detached signature #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I 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.

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.

What steps will reproduce the problem?
1. Produce signature with Reference uri which is not accessible
2. make the verifying using this code
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);

What is the expected output? 
An exception thrown, Exception in thread "main" xades4j.XAdES4jXMLSigException: 
Error verifying the signature....
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 (file not found)
.....

What version of the product are you using? On what operating system?

last version of xades4j 1.3.2 
Operating system : windows 7 64bits
Java version : java 6

Original issue reported on code.google.com by mlikakha...@gmail.com on 5 Dec 2014 at 5:15

GoogleCodeExporter commented 9 years ago
This isn't really an issue with the library. Since you also posted a question 
on stackoverflow, I'll answer there.

http://stackoverflow.com/questions/27313789/validate-xades-signature-with-xades4
j

Original comment by luis.fgoncalv on 8 Dec 2014 at 9:32