Description
Adding 3 certificates to XAdESSigner cert parameter creates 3 X509Certificate nodes in X509Data and 3 xades:Certxades:CertDigest elements. This is not the problem.
If this goes to XAdESVerifier if fails with:
signxml.exceptions.InvalidDigest: Digest mismatch for certificate digest
Looking at the code, I think it does not match a certificate with its digest.
_verify_cert_digest goes over a list and compares to one given in call parameter. In the given case this will always raise an exception of not matching.
The cert parameter to XAdESSigner delineates that it can accept multiple certs. The one that represents the signature and its CA chain.
If I read the spec properly (https://www.w3.org/TR/xmldsig-core/#sec-X509Data). The certificate representing the signature should be in separate X509Data with detailed info from certificate, and CA chain certificates should be in separate X509Data with X509Certificate elementc. This would also eliminate the problem as there would be only one xades:Cert, the one for signing certificate, that would be checked against the data in separate X509Data element for signing certificate. The rest of CA chain would be ignored for comparing to CertDigest.