[xmlsec] Error when compiling xmlsec example

Alfredo Esteban aedelatorre at gmail.com
Fri Feb 7 18:15:23 PST 2014


Hi,

Thanks for libxmlsec library.

I'm trying to use sign1.c example from Debian Wheezy ligxmlsec1 package.

1.- I copy sign1.c from examples /usr/share/doc/libxmlsec1-dev/examples/
2.- I define crypto library at the beginning of sign1.c: #define
XMLSEC_CRYPTO_OPENSSL
3.- I compile with: gcc -I/usr/include/libxml2 -I/usr/include/xmlsec1
-o sign1 -lxmlsec1 -lxmlsec1-openssl -lxml2 -lssl sign1.c
4.- I copy sign1-tmpl.xml template from /usr/share/doc/libxmlsec1-dev/examples/
5.- I generate a private key with openssl (no pass phrase)
6.- I run sign1

I get this error:

> ./sign1 sign1-tmpl.xml newkey.pem
func=xmlSecDSigCtxProcessSignatureNode:file=xmldsig.c:line=463:obj=unknown:subj=dsigCtx->signValueNode
== NULL:error=100:assertion:
func=xmlSecDSigCtxSign:file=xmldsig.c:line=303:obj=unknown:subj=xmlSecDSigCtxSigantureProcessNode:error=1:xmlsec
library function failed:
Error: signature failed

However, xmlsec1 works fine from command line (xmlsec1 --sign
--privkey-pem newkey.pem  --output signed.xml sign1-tmpl.xml)

I tried with gnutls crypto library but this is not able to load a
certificate generated by openssl:

> ./sign1 sign1-tmpl.xml newkey.pem
func=xmlSecGCryptAppKeyLoadMemory:file=app.c:line=232:obj=unknown:subj=xmlSecGCryptAppKeyLoadMemory:error=9:feature
is not implemented:
func=xmlSecGCryptAppKeyLoad:file=app.c:line=176:obj=unknown:subj=xmlSecGCryptAppKeyLoadMemory:error=1:xmlsec
library function
failed:filename=../simple_client/CA/demoCA/private/cakey.pem
Error: failed to load private pem key from "newkey.pem"

Thanks in advance for any help,

Aestu


More information about the xmlsec mailing list