digidoc4j icon indicating copy to clipboard operation
digidoc4j copied to clipboard

Content in trailing section of signature xml

Open johan-fm opened this issue 7 years ago • 6 comments

Digidoc4j fails to read a signature when the signature file has trailing information after the xml tags. DigiDoc3 client opens the container correctly and displays the signature. This invalid_signature.txt is the ending of the signature file in question. If the comment is correct for the file then it seems to be created by "libdigidoc Android".

The error produced from parsing is:

org.digidoc4j.impl.bdoc.xades.XadesValidationDssFacade - Failed to parse xades signature: org.xml.sax.SAXParseException; lineNumber: 210; columnNumber: 24; Content is not allowed in trailing section.
org.digidoc4j.exceptions.InvalidSignatureException: Invalid signature document
	at org.digidoc4j.impl.bdoc.xades.XadesValidationDssFacade.openXadesValidator(XadesValidationDssFacade.java:50)
	at org.digidoc4j.impl.bdoc.xades.XadesValidationReportGenerator.createXadesValidator(XadesValidationReportGenerator.java:93)
	at org.digidoc4j.impl.bdoc.xades.XadesValidationReportGenerator.initXadesValidator(XadesValidationReportGenerator.java:86)
	at org.digidoc4j.impl.bdoc.xades.XadesValidationReportGenerator.openDssSignature(XadesValidationReportGenerator.java:62)
	at org.digidoc4j.impl.bdoc.xades.XadesSignatureParser.parse(XadesSignatureParser.java:28)
	at org.digidoc4j.impl.bdoc.BDocSignatureOpener.createBDocSignature(BDocSignatureOpener.java:49)
	at org.digidoc4j.impl.bdoc.BDocSignatureOpener.parse(BDocSignatureOpener.java:42)
	at org.digidoc4j.impl.bdoc.BDocContainer.parseSignatureFiles(BDocContainer.java:111)
	at org.digidoc4j.impl.bdoc.ExistingBDocContainer.populateContainerWithParseResult(ExistingBDocContainer.java:196)
	at org.digidoc4j.impl.bdoc.ExistingBDocContainer.openContainer(ExistingBDocContainer.java:188)
	at org.digidoc4j.impl.bdoc.ExistingBDocContainer.<init>(ExistingBDocContainer.java:62)
	at org.digidoc4j.ContainerOpener.open(ContainerOpener.java:119)

johan-fm avatar Dec 08 '17 08:12 johan-fm

Created issue in Jira: https://jira.ria.ee/browse/DD4J-177

nostneji avatar Dec 11 '17 08:12 nostneji

Issue is resolved since DSS-5.0.

nostneji avatar Feb 15 '18 10:02 nostneji

Still getting this error with version 2.1.0 Failed to parse xades signature: org.xml.sax.SAXParseException; lineNumber: 205; columnNumber: 24; Content is not allowed in trailing section. [Fatal Error] :205:24: Content is not allowed in trailing section. Exception in thread "main" Invalid signature document

With .bdoc file that has two signatures and one of them has content in trailing section

Adresnik avatar Apr 09 '18 14:04 Adresnik

The error is still present in 3.3.0 and 4.0.0-RC1.

markoleek avatar Jan 08 '20 07:01 markoleek

Could you provide us the test file you see the problem with? With the file we are using all seems to be okay.

naare avatar Jan 09 '20 09:01 naare

Unfortunately I cannot, as I do not own the contents of the file and did not get permission to share it. You can contact me via email for further information.

markoleek avatar Feb 18 '20 09:02 markoleek