Thanks for your answer, Aleksey.<div><br><div>I think I've understood behaviour of xmlsec in this situation.</div><div>And according to this logic I assume (and actually I checked it) that when there isn't any</div>
<div>valid certificate chain result code of signature verification is still succeeded. Why?</div><div><br></div><div>Here is example using command-line tool.</div><div>ca.crt isn't related to the certificate in license-signed-ca1-server1.xml. So, there isn't any valid certificate chain. Why verification status is OK?</div>
<div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">#xmlsec1 --verify --trusted-pem cas/ca2/ca/certs/ca.crt license-signed-ca1-server1.xml</blockquote>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">func=xmlSecOpenSSLX509StoreVerify:file=x509vfy.c:line=360:obj=x509-store:subj=X509_verify_cert:error=4:crypto library function failed:subj=/C=UA/ST=Kyiv region/L=Kyiv/O=test/OU=Ukraine Department/CN=server1/emailAddress=<a href="mailto:support@test.com">support@test.com</a>;err=20;msg=unable to get local issuer certificate<br>
func=xmlSecOpenSSLX509StoreVerify:file=x509vfy.c:line=408:obj=x509-store:subj=unknown:error=71:certificate verification failed:err=20;msg=unable to get local issuer certificate<br>OK<br>SignedInfo References (ok/all): 1/1<br>
Manifests References (ok/all): 0/0</blockquote></div><div><br></div><div><br></div><div>So, I have another question: Is it possibe to detect with xmlsec that there is no one valid certificate chain up to the one of the trusted certificates? I want to reject signed xml file if there isn't any valid vertificate chain.</div>
<div><br></div><div>Thanks.</div><div><br><div class="gmail_quote">2012/8/14 Aleksey Sanin <span dir="ltr"><<a href="mailto:aleksey@aleksey.com" target="_blank">aleksey@aleksey.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Roman,<br>
<br>
During the verification, xmlsec tries to verify the signature using<br>
all possible certificate chains. It is enough to have one of them<br>
succeed. The errors you see are from ones that failed. Safe to ignore<br>
as long, just check the result code.<br>
<br>
Aleksey<br>
<div class="im"><br>
On 8/14/12 8:38 AM, Roman Khlystik wrote:<br>
> Hi Aleksey!<br>
><br>
> I'm trying to develop simple license system using xmlsec library.<br>
> My idea was to build simple private PKI with one CA key pair and<br>
> separate key-pair for each customer.<br>
> Then I planned to sign xml license file with client certificate for each<br>
> client.<br>
><br>
> I decided to embbed CA certificate in our app and verify certificate<br>
> chain from xml file up to CA certificate.<br>
> But I have a problem with xmlsec library. I can't find how to verify<br>
> full certificate chain with it.<br>
> I used example from here<br>
> <a href="http://www.aleksey.com/xmlsec/api/xmlsec-verify-with-x509.html%C2%B7" target="_blank">http://www.aleksey.com/xmlsec/api/xmlsec-verify-with-x509.html·</a><br>
</div>> <<a href="http://www.aleksey.com/xmlsec/api/xmlsec-verify-with-x509.html%C2%B7" target="_blank">http://www.aleksey.com/xmlsec/api/xmlsec-verify-with-x509.html%C2%B7</a>><br>
<div class="im">> and I have a problem when certificate chain is invalid.<br>
> I got error to console:<br>
><br>
> func=xmlSecOpenSSLX509StoreVerify:file=x509vfy.c:line=360:obj=x509-store:subj=X509_verify_cert:error=4:crypto<br>
> library function failed:subj=/C=UA/ST=Kyiv<br>
> region/L=Kyiv/O=test/OU=test/CN=server1/emailAddress=s<br>
> func=xmlSecOpenSSLX509StoreVerify:file=x509vfy.c:line=408:obj=x509-store:subj=unknown:error=71:certificate<br>
> verification failed:err=20;msg=unable to get local issuer certificate<br>
> OK<br>
> SignedInfo References (ok/all): 1/1·<br>
> Manifests References (ok/all): 0/0·<br>
><br>
> but verification result dsigCtx->status has xmlSecDSigStatusSucceeded value.<br>
><br>
> Can you tell me how can I verify that certificate chain is invalid with<br>
> xmlsec api?<br>
><br>
><br>
</div>> _______________________________________________<br>
> xmlsec mailing list<br>
> <a href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a><br>
> <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br>
><br>
</blockquote></div><br></div></div>