[xmlsec] Some questions of using XPath expressions with xmlsec1

Govind Krishnamurthi govs23 at hotmail.com
Tue Apr 20 10:44:30 PDT 2004


Hello Aleksey,

I am trying to get some simple XPath expressions working with xmlsec1 and I 
am running into some
problems. The command I used is as follows xmlsec1 sign ./mysample.xml 
--node-xpath /nutrition/food mykey.pem

I am getting the following error
xmlsec1 sign ./mysample.xml --node-xpath /nutrition/food mykey.pem
Error: failed to find default node with name="Signature"
Error: failed to load template "./mysample.xml"
Error: failed to sign file "./mysample.xml"

Does this need a template too? I therefore tried with an existing template 
file follows

xmlsec1 sign sign1-tmpl.xml --node-xpath /Data mykey.pem and I get the 
following errors

func=xmlSecKeysMngrGetKey:file=keys.c:line=1364:obj=unknown:subj=xmlSecKeysMngrFindKey:error=1:xmlsec 
library function failed:
func=xmlSecDSigCtxProcessKeyInfoNode:file=xmldsig.c:line=871:obj=unknown:subj=unknown:error=45:key 
is not found:
func=xmlSecDSigCtxProcessSignatureNode:file=xmldsig.c:line=565:obj=unknown:subj=xmlSecDSigCtxProcessKeyInfoNode:error=1:xmlsec 
library function failed:
func=xmlSecDSigCtxSign:file=xmldsig.c:line=303:obj=unknown:subj=xmlSecDSigCtxSigantureProcessNode:error=1:xmlsec 
library function failed:
Error: signature failed
Error: failed to sign file "./sign1-tmpl.xml"


Also, I was trying to get some code going on using xpath expressions to sign 
a part of the document and I came across this email from the archives 
sometime in 2002. It uses apis like xmlSecReferenceAddTransform and 
xmlSecTransformXPathAdd to incorporate xpath expressions when signing files. 
These don't seem to exist anymore.
Could you, or anyone, post an example, if possible, on signing/encrypting 
portions of document.

Finally, I tried to compile the xkms-server.c example and it does not 
compile for me. I thought
I will let you know as in your Changelog you indicate that this example is 
finished. Here are the errors that I get. I didn't touch the file so the 
parse error is not mine :) I did do a "--enable-xkms" in the configure 
script and recompiled, however  the core xmlsec does not compile with 
similar errors.  Seemingly the error implies some include library problems. 
I didn't really investigate much as I'm not using xkms right now. But I 
thought I will let you know. I am using xmlsec1-1.2.5 with libxml2-2.6.9 and 
libxslt-1.0.31 and openssl 0.7.9. The other examples do compile.

xkms-server.c:82: parse error before "xmlSecXkmsServerCtxPtr"
xkms-server.c: In function `main':
xkms-server.c:100: `xmlSecXkmsServerCtxPtr' undeclared (first use in this 
function)
xkms-server.c:100: (Each undeclared identifier is reported only once
xkms-server.c:100: for each function it appears in.)
xkms-server.c:100: parse error before "xkmsCtx"
xkms-server.c:101: `xmlSecXkmsServerFormat' undeclared (first use in this 
function)
xkms-server.c:165: `xkmsCtx' undeclared (first use in this function)
xkms-server.c:182: `format' undeclared (first use in this function)
xkms-server.c:183: `xmlSecXkmsServerFormatUnknown' undeclared (first use in 
this function)
xkms-server.c: At top level:
xkms-server.c:415: parse error before "xmlSecXkmsServerCtxPtr"
xkms-server.c: In function `handle_connection':
xkms-server.c:427: `xmlSecXkmsServerCtxPtr' undeclared (first use in this 
function)
xkms-server.c:427: parse error before "xkmsCtx2"
xkms-server.c:437: `xkmsCtx' undeclared (first use in this function)
xkms-server.c:459: `xkmsCtx2' undeclared (first use in this function)
xkms-server.c:509: `format' undeclared (first use in this function)
xkms-server.c:509: warning: assignment makes pointer from integer without a 
cast

Thanks in advance,
Govind.

_________________________________________________________________
Lose those love handles! MSN Fitness shows you two moves to slim your waist. 
http://fitness.msn.com/articles/feeds/article.aspx?dept=exercise&article=et_pv_030104_lovehandles




More information about the xmlsec mailing list