3 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4 <title>Creating a framework from the skeleton.</title>
5 <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
6 <link rel="HOME" title="XML Security Library Reference Manual" href="index.html">
7 <link rel="UP" title="Adding support for new cryptographic library." href="xmlsec-notes-new-crypto.html">
8 <link rel="PREVIOUS" title="Adding support for new cryptographic library." href="xmlsec-notes-new-crypto.html">
9 <link rel="NEXT" title="xmlSecCryptoApp* functions." href="xmlsec-notes-new-crypto-functions.html">
10 <style type="text/css">.synopsis, .classsynopsis {
12 border: solid 1px #aaaaaa;
17 border: solid 1px #aaaaff;
26 border: solid 1px #ffaaaa;
33 .navigation a:visited {
40 <body><table witdh="100%" valign="top"><tr valign="top">
41 <td valign="top" align="left" width="210">
42 <img src="../images/logo.gif" alt="XML Security Library" border="0"><p></p>
44 <li><a href="../index.html">Home</a></li>
45 <li><a href="../download.html">Download</a></li>
46 <li><a href="../news.html">News</a></li>
47 <li><a href="../documentation.html">Documentation</a></li>
49 <li><a href="../faq.html">FAQ</a></li>
50 <li><a href="../api/xmlsec-notes.html">Tutorial</a></li>
51 <li><a href="../api/xmlsec-reference.html">API reference</a></li>
52 <li><a href="../api/xmlsec-examples.html">Examples</a></li>
54 <li><a href="../xmldsig.html">XML Digital Signature</a></li>
55 <ul><li><a href="http://www.aleksey.com/xmlsec/xmldsig-verifier.html">Online Verifier</a></li></ul>
56 <li><a href="../xmlenc.html">XML Encryption</a></li>
57 <li><a href="../c14n.html">XML Canonicalization</a></li>
58 <li><a href="../bugs.html">Reporting Bugs</a></li>
59 <li><a href="http://www.aleksey.com/pipermail/xmlsec">Mailing list</a></li>
60 <li><a href="../related.html">Related</a></li>
61 <li><a href="../authors.html">Authors</a></li>
66 <td><a href="http://xmlsoft.org/"><img src="../images/libxml2-logo.png" alt="LibXML2" border="0"></a></td>
70 <td><a href="http://xmlsoft.org/XSLT"><img src="../images/libxslt-logo.png" alt="LibXSLT" border="0"></a></td>
74 <td><a href="http://www.openssl.org/"><img src="../images/openssl-logo.png" alt="OpenSSL" border="0"></a></td>
76 <!--Links - start--><!--Links - end-->
79 <td valign="top"><table width="100%" valign="top"><tr><td valign="top" align="left" id="xmlsecContent">
80 <table width="100%" class="navigation" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
81 <td><a accesskey="p" href="xmlsec-notes-new-crypto.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
82 <td><a accesskey="u" href="xmlsec-notes-new-crypto.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
83 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
84 <th width="100%" align="center">XML Security Library Reference Manual</th>
85 <td><a accesskey="n" href="xmlsec-notes-new-crypto-functions.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
87 <br clear="all"><div class="SECT1">
88 <h1 class="SECT1"><a name="XMLSEC-NOTES-NEW-CRYPTO-SKELETON">Creating a framework from the skeleton.</a></h1>
89 <p> The XML Security Library contains a "skeleton" for creating new
90 "xmlsec-<crypto>" libraries. In order to create "xmlsec-mycrypto"
91 library framework, do the following (this example assumes that you
92 are using *nix system, adjust the commands if you are using something else):
97 <p> Copy src/skeleton and include/xmlsec/skeleton folders to src/mycrypto and
98 include/xmlsec/mycrypto folders and remove CVS folders from the result:
100 <div class="EXAMPLE">
101 <a name="AEN512"></a><p><b>Example 1. Coping skeleton folders.</b></p>
102 <pre class="PROGRAMLISTING">cd src
103 cp -r skeleton mycrypto
108 cp -r skeleton mycrypto
116 <p> Replace "skeleton" with "mycrypto" in the copied files (note that there
117 are different possible cases here):
119 <div class="EXAMPLE">
120 <a name="AEN517"></a><p><b>Example 2. Replacing "skeleton" with "mycrypto".</b></p>
121 <pre class="PROGRAMLISTING">for i in `ls include/xmlsec/mycrypto/* src/mycrypto/*`; do
122 echo Processing $i ..;
123 sed 's/skeleton/mycrypto/g' $i | \
124 sed 's/SKELETON/MYCRYPTO/g' | \
125 sed 's/Skeleton/MyCrypto/g' > $i.tmp;
132 <p> Add "xmlsec-mycrypto" library to the "include/xmlsec/crypto.h" file:
134 <div class="EXAMPLE">
135 <a name="AEN522"></a><p><b>Example 3. Modifying include/xmlsec/crypto.h file.</b></p>
136 <pre class="PROGRAMLISTING">...
137 #ifdef XMLSEC_CRYPTO_MYCRYPTO
138 #include <xmlsec/mycrypto/app.h>
139 #include <xmlsec/mycrypto/crypto.h>
140 #include <xmlsec/mycrypto/symbols.h>
141 #else /* XMLSEC_CRYPTO_MYCRYPTO */
143 #endif /* XMLSEC_CRYPTO_MYCRYPTO */
149 <p> Add "xmlsec-crypto" library to the configure.in file (for *nix systems;
150 for Windows you need to modify win32/confgure.js and win32/Makefile.msvc
151 files, see win32/README.txt for details):
153 <div class="EXAMPLE">
154 <a name="AEN527"></a><p><b>Example 4. Modifying configure.in file.</b></p>
155 <pre class="PROGRAMLISTING">dnl ==========================================================================
156 dnl See if we can find MyCrypto
157 dnl ==========================================================================
158 XMLSEC_MYCRYPTO_DEFINES=""
159 MYCRYPTO_CONFIG="mycrypto-config" # TODO
160 XMLSEC_NO_MYCRYPTO="1"
161 MYCRYPTO_MIN_VERSION="0.0.0" # TODO
167 AC_MSG_CHECKING(for mycrypto libraries >= $MYCRYPTO_MIN_VERSION)
168 AC_ARG_WITH(mycrypto, [ --with-mycrypto=[PFX] mycrypto location])
169 if test "$with_mycrypto" = "no" ; then
170 XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST mycrypto"
173 if test "$with_mycrypto" != "" ; then
174 MYCRYPTO_PREFIX=$with_mycrypto
175 MYCRYPTO_CONFIG=$MYCRYPTO_PREFIX/bin/$MYCRYPTO_CONFIG
177 if ! $MYCRYPTO_CONFIG --version > /dev/null 2>&1 ; then
178 if test "$with_mycrypto" != "" ; then
179 AC_MSG_ERROR(Unable to find mycrypto at '$with_mycrypto')
182 vers=`$MYCRYPTO_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
183 minvers=`echo $MYCRYPTO_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
184 if test "$vers" -ge "$minvers" ; then
185 MYCRYPTO_LIBS="`$MYCRYPTO_CONFIG --libs`"
186 MYCRYPTO_CFLAGS="`$MYCRYPTO_CONFIG --cflags`"
187 MYCRYPTO_VERSION="`$MYCRYPTO_CONFIG --version`"
188 XMLSEC_NO_MYCRYPTO="0"
190 AC_MSG_ERROR(You need at least mycrypto $MYCRYPTO_MIN_VERSION for this version of $PACKAGE)
194 dnl update crypt libraries list
195 if test "z$XMLSEC_NO_MYCRYPTO" = "z0" ; then
196 dnl first crypto library is default one
197 if test "z$XMLSEC_CRYPTO" = "z" ; then
198 XMLSEC_CRYPTO="mycrypto"
199 XMLSEC_CRYPTO_LIB="xmlsec1-mycrypto"
200 XMLSEC_CRYPTO_CFLAGS="$MYCRYPTO_CFLAGS -DXMLSEC_CRYPTO_MYCRYPTO=1"
201 XMLSEC_CRYPTO_LIBS="$MYCRYPTO_LIBS"
202 XMLSEC_CRYPTO_LDADDS="$MYCRYPTO_LDADDS"
204 XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST mycrypto"
205 AC_MSG_RESULT(yes ('$MYCRYPTO_VERSION'))
207 XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST mycrypto"
211 AC_SUBST(XMLSEC_NO_MYCRYPTO)
212 AC_SUBST(MYCRYPTO_MIN_VERSION)
213 AC_SUBST(MYCRYPTO_VERSION)
214 AC_SUBST(MYCRYPTO_CONFIG)
215 AC_SUBST(MYCRYPTO_PREFIX)
216 AC_SUBST(MYCRYPTO_CFLAGS)
217 AC_SUBST(MYCRYPTO_LIBS)
218 AC_SUBST(MYCRYPTO_LDADDS)
219 AC_SUBST(XMLSEC_MYCRYPTO_DEFINES)
224 include/xmlsec/mycrypto/Makefile
225 src/mycrypto/Makefile
231 <li><p>Modify "xmlsec.spec.in" file to create "xmlsec-mycrypto"
236 By now you should be able to sucessfuly compile XML Security Library
237 with MyCrypto library (we disable all other libraries to make sure
238 that xmlsec command line utility is linked against xmlsec-mycrypto
240 <div class="EXAMPLE">
241 <a name="AEN532"></a><p><b>Example 5. Compiling the results.</b></p>
242 <pre class="PROGRAMLISTING">./autogen.sh --without-openssl --without-nss --without-gnutls \
243 --with-mycrypto=$HOME --disable-tmpl-tests
248 <table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="2"><tr valign="middle">
249 <td align="left"><a accesskey="p" href="xmlsec-notes-new-crypto.html"><b><<< Adding support for new cryptographic library.</b></a></td>
250 <td align="right"><a accesskey="n" href="xmlsec-notes-new-crypto-functions.html"><b>xmlSecCryptoApp* functions. >>></b></a></td>
252 </td></tr></table></td>