goxmldsig
goxmldsig copied to clipboard
Beginning of a Go version of github.com/open-eid/libdigidoc
Adding support for XMLDSIG for files and going towards XAdES.
The edoc documents can be tested on https://www.eparaksts.lv/en/. Currently not passing. Marking a draft
Remaining issues,
11.03.2021 15:45:34.066 WARN [main] [o.a.x.s.signature.XMLSignature.checkSignatureValue:775] - Signature verification failed.
11.03.2021 15:45:34.067 WARN [main] [e.e.e.d.x.validation.XAdESSignature.checkSignatureIntegrity:741] - Determining signing certificate from certificate candidates list failed: [Certificate #1: Signature verification failed]
11.03.2021 15:45:34.073 WARN [main] [o.a.xml.security.signature.Reference.verify:815] - Verification failed for URI "#S1-SignedProperties"
11.03.2021 15:45:34.074 WARN [main] [o.a.xml.security.signature.Reference.verify:816] - Expected Digest: 38D3n1Lrfx0+y014nTSTt9/60gFyvlmRfsiaW30Z348=
11.03.2021 15:45:34.074 WARN [main] [o.a.xml.security.signature.Reference.verify:817] - Actual Digest: 1dSIVs1cmRc+8NZeRulhbtI1ED3rw1QHgUh4IBlTuXE=
11.03.2021 15:45:34.103 WARN [main] [e.e.e.d.x.v.XAdESTimestampSource.makeTimestampToken:239] - Unable to build timestamp token from binaries 'MDAwLgIBAjAlDCNCYWQgcmVxdWVzdCBmb3JtYXQgb3Igc3lzdGVtIGVycm9yLgMCAgQ='. Reason : Malformed content.
org.bouncycastle.cms.CMSException: Malformed content.
at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source)
at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source)
at org.bouncycastle.cms.CMSSignedData.<init>(Unknown Source)
at eu.europa.esig.dss.validation.timestamp.TimestampToken.<init>(TimestampToken.java:160)
at eu.europa.esig.dss.xades.validation.XAdESTimestampSource.makeTimestampToken(XAdESTimestampSource.java:236)
at eu.europa.esig.dss.xades.validation.XAdESTimestampSource.makeTimestampToken(XAdESTimestampSource.java:63)
at eu.europa.esig.dss.validation.timestamp.AbstractTimestampSource.makeTimestampTokens(AbstractTimestampSource.java:321)
at eu.europa.esig.dss.validation.timestamp.AbstractTimestampSource.createAndValidate(AbstractTimestampSource.java:234)
at eu.europa.esig.dss.validation.timestamp.AbstractTimestampSource.getSignatureTimestamps(AbstractTimestampSource.java:126)
at eu.europa.esig.dss.validation.DefaultAdvancedSignature.getSignatureTimestamps(DefaultAdvancedSignature.java:427)
at eu.europa.esig.dss.validation.DefaultAdvancedSignature.hasTProfile(DefaultAdvancedSignature.java:470)
at eu.europa.esig.dss.xades.validation.XAdESSignature.hasTProfile(XAdESSignature.java:666)
at eu.europa.esig.dss.xades.validation.XAdESSignature.getDataFoundUpToLevel(XAdESSignature.java:1110)
at org.digidoc4j.impl.asic.xades.XadesSignatureParser.parse(XadesSignatureParser.java:39)
at org.digidoc4j.impl.asic.AsicSignatureParser.createXadesSignature(AsicSignatureParser.java:43)
at org.digidoc4j.impl.asic.AsicSignatureParser.parse(AsicSignatureParser.java:38)
at org.digidoc4j.impl.asic.AsicContainerParser.parseSignatures(AsicContainerParser.java:254)
at org.digidoc4j.impl.asic.AsicContainerParser.populateParseResult(AsicContainerParser.java:242)
at org.digidoc4j.impl.asic.AsicContainerParser.read(AsicContainerParser.java:89)
at org.digidoc4j.ContainerOpener.openAsicContainer(ContainerOpener.java:128)
at org.digidoc4j.ContainerOpener.open(ContainerOpener.java:61)
at org.digidoc4j.ContainerOpener.open(ContainerOpener.java:81)
at org.digidoc4j.main.CommandLineExecutor.openContainer(CommandLineExecutor.java:208)
at org.digidoc4j.main.DigiDoc4J.execute(DigiDoc4J.java:140)
at org.digidoc4j.main.DigiDoc4J.run(DigiDoc4J.java:104)
at org.digidoc4j.main.DigiDoc4J.main(DigiDoc4J.java:52)
Caused by: java.lang.ClassCastException: class org.bouncycastle.asn1.DLSequence cannot be cast to class org.bouncycastle.asn1.ASN1ObjectIdentifier (org.bouncycastle.asn1.DLSequence and org.bouncycastle.asn1.ASN1ObjectIdentifier are in unnamed module of loader 'app')
at org.bouncycastle.asn1.cms.ContentInfo.<init>(Unknown Source)
at org.bouncycastle.asn1.cms.ContentInfo.getInstance(Unknown Source)
... 26 common frames omitted
11.03.2021 15:45:34.464 INFO [pool-1-thread-1] [e.e.e.d.v.SignedDocumentValidator.validateDocument:358] - Document validation...
11.03.2021 15:45:34.535 WARN [pool-1-thread-1] [e.e.esig.xmldsig.XSDAbstractUtils.validateAgainstXSD:110] - Error during the XML schema validation! Reason : [cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.w3.org/2000/09/xmldsig#":X509IssuerSerialNumber}'. One of '{"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber}' is expected.]