This is the error when root CA is in the signed xml<br><br>func=xmlSecOpenSSLX509StoreVerify:file=d:\svn_simulator\white\products\76xx\app\module\wrtconfig\wrtconfig\external\libxmlsec\src\openssl\x509vfy<br>.c:line=360:obj=x509-store:subj=X509_verify_cert:error=4:crypto library function failed:subj=/C=IN/ST=Mah/L=Pune/O=Agreeya/OU=Almond/CN=rootca/emailAd<br>
dress=<a href="mailto:rootca@agreeya.com">rootca@agreeya.com</a>;err=19;msg=self signed certificate in certificate chain<br>func=xmlSecOpenSSLX509StoreVerify:file=d:\svn_simulator\white\products\76xx\app\module\wrtconfig\wrtconfig\external\libxmlsec\src\openssl\x509vfy<br>
.c:line=408:obj=x509-store:subj=unknown:error=71:certificate verification failed:err=19;msg=self signed certificate in certificate chain<br><br>this is the error when root ca is not in the signed xml, but passed explicitly as trusted.<br>
<br>func=xmlSecOpenSSLX509StoreVerify:file=d:\svn_simulator\white\products\76xx\app\module\wrtconfig\wrtconfig\external\libxmlsec\src\openssl\x509vfy<br>.c:line=360:obj=x509-store:subj=X509_verify_cert:error=4:crypto library function failed:subj=/C=IN/ST=Maharashtra/L=Pune/O=Agreeya/OU=Almond/CN=ca1/em<br>
ailAddress=<a href="mailto:ca1@agreeya.com">ca1@agreeya.com</a>;err=24;msg=invalid CA certificate<br>func=xmlSecOpenSSLX509StoreVerify:file=d:\svn_simulator\white\products\76xx\app\module\wrtconfig\wrtconfig\external\libxmlsec\src\openssl\x509vfy<br>
.c:line=408:obj=x509-store:subj=unknown:error=71:certificate verification failed:err=24;msg=invalid CA certificate<br><br><br>Thanks,<br>Naval.<br><br><div class="gmail_quote">On Wed, Dec 22, 2010 at 11:27 AM, Aleksey Sanin <span dir="ltr"><<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Could you please copy/paste the complete error?<br>
<br>
Aleksey<div class="im"><br>
<br>
On 12/21/10 9:56 PM, Naval Patel wrote:<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
If the entire cert chain is in the signed document the error i get is<br>
msg=self signed certificate in certificate chain<br>
<br>
if i remove the Root certificate from the chain in the signed xml file,<br>
and pass a root certificate as trusted, then i get the error as<br>
msg=invalid CA certificate<br>
<br>
is there something that i am missing or this is not the right way to do?<br>
<br>
thanks :)<br>
<br>
Naval.<br>
<br>
On Tue, Dec 21, 2010 at 9:24 PM, Aleksey Sanin <<a href="mailto:aleksey@aleksey.com" target="_blank">aleksey@aleksey.com</a><br></div><div><div></div><div class="h5">
<mailto:<a href="mailto:aleksey@aleksey.com" target="_blank">aleksey@aleksey.com</a>>> wrote:<br>
<br>
What errors do you get?<br>
<br>
Aleksey<br>
<br>
<br>
On 12/21/10 12:38 AM, Naval Patel wrote:<br>
<br>
Hi,<br>
<br>
Its been quite some time i am modifying my code to allow a<br>
signed xml<br>
document containing the entire chain of certificates from "Local<br>
cert"<br>
through CAs and ultimately the Root CA. I have debugged the code<br>
till<br>
the call goes to *X509_verify_cert(&xsc)*. I have observed that<br>
for each<br>
*<X509Certificate> *the xmlsec adds the certificate to the<br>
X509_STACK.<br>
The function call (*xmlSecOpenSSLX509FindNextChainCert*) inside<br>
the *for<br>
loop* inside the function *xmlSecOpenSSLX509StoreVerify* with the<br>
comment [/* get one cert after another and try to verify */] returns<br>
NULL only when it finds that the certificate does not extend any<br>
other<br>
certificates.<br>
<br>
I have RootCa.pem > CA1.pem > CA2.pem > signerCert.pem.<br>
<br>
If i simply execute the signeddoc.xml, I am receiving the error<br>
[*msg=invalid CA certificate* for CA2.pem] ... the command used is<br>
*xmlsec.exe verify --trusted-pem RootCa.pem signeddoc.xml*<br>
I broke the certificate chain by removing RootCa.pem from the<br>
signeddoc.xml and the error i received is same as of the above case<br>
*xmlsec.exe verify --trusted-pem RootCa.pem signeddoc.xml<br>
*I changed the command for the above file as *xmlsec.exe verify<br>
--trusted-pem RootCa.pem --trusted-pem CA2.pem signeddoc.xml*,<br>
still the<br>
error was same<br>
I maintained only CA1, CA2 and signerCert.pem in signeddoc.xml<br>
and used<br>
the command *xmlsec.exe verify --trusted-pem RootCa.pem<br>
--trusted-pem<br>
CA1.pem --trusted-pem CA2.pem signeddoc.xml<br>
*Now I removed CA2 from the signeddoc.xml and kept only CA1 and<br>
signerCert.pem, and used the command *xmlsec.exe verify<br>
--trusted-pem<br>
RootCa.pem --trusted-pem CA1.pem --trusted-pem CA2.pem<br>
signeddoc.xml ...<br>
*i could see that the verification was passing.<br>
<br>
I have deviced another way too to make this work, but i am not<br>
sure how<br>
good this way is...<br>
<br>
before passing the signeddoc.xml to xmlsec, I load the<br>
x509certificate<br>
as trusted using the api *xmlSecCryptoAppKeysMngrCertLoadMemory*<br>
but the<br>
problem is not solved because the same document continues to be<br>
evaluated by xmlsec later and the results produced are same.<br>
<br>
Another alternative i thought was once the function<br>
*xmlSecOpenSSLX509FindNextChainCert *returns NULL, I would<br>
remove the<br>
other certificates from the STACK. That way, i will have trusted<br>
certs<br>
loaded to the global stack and while signerCert.pem is verified.<br>
<br>
Please let me know your suggestions, I will try your suggested<br>
methods.<br>
<br>
And thanks a lot for this library, it had done wonders for my<br>
work till<br>
now :)<br>
<br>
I had read an email from the archive<br>
[*<a href="http://www.aleksey.com/pipermail/xmlsec/2008/008326.html*" target="_blank">http://www.aleksey.com/pipermail/xmlsec/2008/008326.html*</a>], but i<br>
could not get the break through yet :(<br>
<br>
Regards,<br>
Naval<br>
<br>
<br>
<br>
_______________________________________________<br>
xmlsec mailing list<br></div></div>
<a href="mailto:xmlsec@aleksey.com" target="_blank">xmlsec@aleksey.com</a> <mailto:<a href="mailto:xmlsec@aleksey.com" target="_blank">xmlsec@aleksey.com</a>><div class="im"><br>
<a href="http://www.aleksey.com/mailman/listinfo/xmlsec" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br>
<br>
<br>
<br>
<br>
--<br>
Naval Patel<br>
~ have fun ~<br>
</div></blockquote>
</blockquote></div><br><br clear="all"><br>-- <br>Naval Patel<br>~ have fun ~<br>