Building the application with XML Security Library. Overview. Compiling and linking application with XML Security Library requires specifying correct compilation flags, library files and paths to include and library files. As we discussed before, XML Security Library consist of the core xmlsec library and several xmlsec-crypto libraries. Application has a choice of selecting crypto library at link time or dynamicaly loading it at run time. Please note, that loading crypto engines dynamicaly may introduce security problems on some platforms. Include files. In order to use XML Security Library an application should include one or more of the following files: xmlsec/xmlsec.h - XML Security Library initialization and shutdown functions; xmlsec/xmldsig.h - XML Digital Signature functions; xmlsec/xmlenc.h - XML Encryption functions; xmlsec/xmltree.h - helper functions for XML documents manipulation; xmlsec/templates.h - helper functions for dynamic XML Digital Signature and XML Encryption templates creation; xmlsec/crypto.h - automatic XML Security Crypto Library selection. If necessary, the application should also include LibXML, LibXSLT and crypto library header files. Example includes file section. #include #include #ifndef XMLSEC_NO_XSLT #include #endif /* XMLSEC_NO_XSLT */ #include #include #include #include #include #include ]]> Compiling and linking on Unix. There are several ways to get necessary compilation and linking information on Unix and application can use any of these methods to do crypto engine selection either at linking or run time. PKG_CHECK_MODULES() macro Using PKG_CHECK_MODULES() macro in a configure.in file to select crypto engine (openssl) at linking time. = 1.0.0 xml2 libxslt,,exit) CFLAGS="$CFLAGS $XMLSEC_CFLAGS" CPPFLAGS="$CPPFLAGS $XMLSEC_CFLAGS" LDFLAGS="$LDFLAGS $XMLSEC_LIBS" ]]> Using PKG_CHECK_MODULES() macro in a configure.in file to enable dynamical loading of xmlsec-crypto library. = 1.0.0 xml2 libxslt,,exit) CFLAGS="$CFLAGS $XMLSEC_CFLAGS" CPPFLAGS="$CPPFLAGS $XMLSEC_CFLAGS" LDFLAGS="$LDFLAGS $XMLSEC_LIBS" ]]> pkg-config script Using pkg-config script in a Makefile to select crypto engine (nss) at linking time. Using pkg-config script in a Makefile to enable dynamical loading of xmlsec-crypto library. xmlsec1-config script Using xmlsec1-config script in a Makefile to select crypto engine (e.g. gnutls) at linking time. Using xmlsec1-config script in a Makefile to enable dynamical loading of xmlsec-crypto library. Compiling and linking on Windows. On Windows there is no such simple and elegant solution. Please check README file in win32 folder of the library package for latest instructions. However, there are few general things, that you need to remember: All libraries linked to your application must be compiled with the same Microsoft Runtime Libraries. Static linking with XML Security Library requires additional global defines: #define LIBXML_STATIC #define LIBXSLT_STATIC #define XMLSEC_STATIC If you do not want to dynamicaly load xmlsec-crypto library and prefer to select crypto engine at linking then you should link your application with xmlsec and at least one of xmlsec-crypto libraries. In order to enable dynamic loading for xmlsec-crypto library you should add additional global define: #define XMLSEC_CRYPTO_DYNAMIC_LOADING Compiling and linking on other systems. Well, nothing is impossible, it's only software (you managed to compile the library itself, do you?). I'll be happy to include in this manual your expirience with compiling and linking applications with XML Security Library on other platforms (if you would like to share it).