I'm trying to submit a signed XML document, but the signature is turning itself to be wrong.The code I'm using looks like this:\[code\] $doc = new DOMDocument(); $doc->loadXML(base64_decode($xmlstr)); $objDSig = new XMLSecurityDSig(); $objDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); $objDSig->addReference($doc, XMLSecurityDSig::SHA1, array('http://www.w3.org/2000/09/xmldsig#enveloped-signature')); $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private')); // load private key $objKey->passphrase = $pass; $objKey->loadKey($tout, TRUE); $objDSig->sign($objKey); // Add associated public key $objDSig->add509Cert(file_get_contents($tout));//dirname(__FILE__) ."/". $firmacert2)); $objDSig->appendSignature($doc->documentElement); $doc->save(dirname(__FILE__) . '/temp/temp.xml'); $codif = file_get_contents(dirname(__FILE__) . '/temp/temp.xml'); $xml_base64 = base64_encode($codif); $param1= new SoapParam($xml_base64, 'xml'); // $xml_base64, 'xml' $com= new SoapClient('https://www.aespd.es:443/agenciapd/axis/SolicitudService?wsdl', array('trace' => 1, 'encoding' => 'UTF-8')); $respuesta2=$com->probarXml($param1); $respuesta = base64_decode($respuesta2);\[/code\]And the xml is being sent, and that's nice, but when i recover the xml file, and check the signature on: http://www.aleksey.com/xmlsec/xmldsig-verifier.html the error I'm getting is:func=xmlSecOpenSSLEvpDigestVerify:file=digests.c:line=229bj=sha1:subj=unknown:error=12:invalid data:data and digest do not matchI tried to transform the certificate into separate private and public keys, same file, different files, importing and exporting and such...The flow goes this way:Java program sends generated unsigned XML base64_encoded to php file, which signs and sends it with a SoapClient, result is printed, then captured and interpreted by Java program, thus avoiding having individual certificates on the machines using this system.I'm really, really stuck, so any help woyuld be greatly appreciated.