Ok, a bit more info. The xmlsec utility will verify the signature without being passed the pem file separately, so it apparently is able to suck the key from the signature. I'm trying to create a minimal size code set that demonstrates the problem, I'll post that when I have it.
<br><br><div class="gmail_quote">On Dec 4, 2007 10:29 AM, Aleksey Sanin &lt;<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Try this one then xmlSecOpenSSLAppKeyCertLoadMemory()<br><br>Aleksey<br><div class="Ih2E3d"><br>Jim Nutt wrote:<br>&gt; No joy. It refuses to load the key. The irony is that I can use the<br>&gt; xmlsec utility and pass it the name of the temp file I create with the
<br>&gt; key and it will load and verify. It just won&#39;t do it in my program.<br>&gt; Here&#39;s the errors I&#39;m seeing:<br>&gt;<br>&gt; func=xmlSecOpenSSLAppKeyLoadBIO:file=app.c:line=260:obj=unknown:subj=d2i_PrivateKey_bio
<br>&gt; and d2i_PUBKEY_bio:error=4:crypto library function failed:<br>&gt; func=xmlSecOpenSSLAppKeyLoadMemory:file=app.c:line=193:obj=unknown:subj=xmlSecOpenSSLAppKeyLoadBIO:error=1:xmlsec<br>&gt; library function failed:
<br>&gt; func=xmlSecDSigCtxProcessKeyInfoNode:file=xmldsig.c:line=871:obj=unknown:subj=unknown:error=45:key<br>&gt; is not found:<br>&gt; func=xmlSecDSigCtxProcessSignatureNode:file=xmldsig.c:line=565:obj=unknown:subj=xmlSecDSigCtxProcessKeyInfoNode:error=1:xmlsec
<br>&gt; library function failed:<br>&gt; func=xmlSecDSigCtxVerify:file=xmldsig.c:line=366:obj=unknown:subj=xmlSecDSigCtxSigantureProcessNode:error=1:xmlsec<br>&gt; library function failed:<br>&gt;<br>&gt; The signature will verify with the xmlsec utility if I pass it the cert,
<br>&gt; just not from my program. My next step is to reduce things to the bare<br>&gt; essentials and try again<br>&gt;<br>&gt; On Dec 4, 2007 2:03 AM, Aleksey Sanin &lt;<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com
</a><br></div><div><div></div><div class="Wj3C7c">&gt; &lt;mailto:<a href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a>&gt;&gt; wrote:<br>&gt;<br>&gt; &nbsp; &nbsp; xmlSecOpenSSLAppKeyLoadMemory() ???<br>&gt;<br>&gt; &nbsp; &nbsp; Aleksey
<br>&gt;<br>&gt; &nbsp; &nbsp; Jim Nutt wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Ok, I&#39;m pulling my hair out on this one. I&#39;m trying to verify an xml<br>&gt; &nbsp; &nbsp; &nbsp;&gt; signature based on the x509 certificate embedded in the keyinfo<br>&gt; &nbsp; &nbsp; and I
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; can not get it to work. If I verify using the same pem file I<br>&gt; &nbsp; &nbsp; used for<br>&gt; &nbsp; &nbsp; &nbsp;&gt; signing, it verifies ok, so I know the signature is valid. The<br>&gt; &nbsp; &nbsp; problem<br>&gt; &nbsp; &nbsp; &nbsp;&gt; is getting it to validate without going to the original pem file.
<br>&gt; &nbsp; &nbsp; I&#39;ve<br>&gt; &nbsp; &nbsp; &nbsp;&gt; tried the straight forward method of letting xmlSecDSigVerify<br>&gt; &nbsp; &nbsp; load the<br>&gt; &nbsp; &nbsp; &nbsp;&gt; key, but it can&#39;t find the key in signature. I&#39;ve even tried<br>&gt; &nbsp; &nbsp; writing the
<br>&gt; &nbsp; &nbsp; &nbsp;&gt; base64 data to a file (bracketed with -----BEGIN CERTIFICATE-----<br>&gt; &nbsp; &nbsp; and<br>&gt; &nbsp; &nbsp; &nbsp;&gt; -----END CERTIFICATE-----) and then loading that file as the<br>&gt; &nbsp; &nbsp; &nbsp;&gt; certificate. It refuses to read the file. And yes, I know the
<br>&gt; &nbsp; &nbsp; file is a<br>&gt; &nbsp; &nbsp; &nbsp;&gt; valid pem file because openssl x509 -in filename -text reads it<br>&gt; &nbsp; &nbsp; just fine.<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Any suggestions would be greatly appreciated, as I&#39;m on a time
<br>&gt; &nbsp; &nbsp; crunch on<br>&gt; &nbsp; &nbsp; &nbsp;&gt; this (now... wasn&#39;t when I started... *sigh*)<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; --<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Jim Nutt<br>&gt; &nbsp; &nbsp; &nbsp;&gt; <a href="http://jim.nuttz.org" target="_blank">
http://jim.nuttz.org</a> &lt;<a href="http://jim.nuttz.org" target="_blank">http://jim.nuttz.org</a>&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; ------------------------------------------------------------------------
<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; _______________________________________________<br>&gt; &nbsp; &nbsp; &nbsp;&gt; xmlsec mailing list<br></div></div>&gt; &nbsp; &nbsp; &nbsp;&gt; <a href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a> &lt;mailto:
<a href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a>&gt;<br><div><div></div><div class="Wj3C7c">&gt; &nbsp; &nbsp; &nbsp;&gt; <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec
</a><br>&gt; &nbsp; &nbsp; &lt;<a href="http://www.aleksey.com/mailman/listinfo/xmlsec" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; Jim Nutt<br>&gt; <a href="http://jim.nuttz.org" target="_blank">
http://jim.nuttz.org</a><br></div></div></blockquote></div><br><br clear="all"><br>-- <br>Jim Nutt<br><a href="http://jim.nuttz.org">http://jim.nuttz.org</a>