1This folder contains XML Security Library examples. 2 31. Files List 4------------------------- 5 6 README This file. 7 Makefile *nix makefile. 8 Makefile.w32 Win32 makefile. 9 cacert.pem Root (trusted) certificate 10 ca2cert.pem CA (trusted) certificate (signed with cacert.pem) 11 rsakey.pem Private PEM key file 12 rsapub.pem Public PEM key file 13 rsacert.pem Certificate for rsakey.pem signed with ca2cert.pem 14 deskey.bin A DES keys 15 sign1.c Signing with a template file 16 sign1-tmpl.xml An example template file for sign1 example 17 sign1-res.xml The result of processing sign1_tmpl.xml by sign1.c 18 sign2.c Signing a file with a dynamicaly created template 19 sign2-doc.xml An example XML file for signing by sign2.c 20 sign2-res.xml The result of signing sign2-doc.xml by sign2.c 21 sign3.c Signing a file with a dynamicaly created template and an X509 certificate 22 sign3-doc.xml An example XML file for signing by sign3.c 23 sign3-res.xml The result of signing sign3-doc.xml by sign3.c 24 verify1.c Verifying a signed document with a single key 25 verify2.c Verifying a signed document using keys manager 26 verify3.c Verifying a signed document using X509 certificate 27 verify4.c Verifying a simple SAML response using X509 certificate 28 verify4-tmpl.xml An example template file with a simple SAML response for verify4 example 29 verify4-res.xml Signed simple SAML response for verification by verify4.c 30 encrypt1.c Encrypting binary data with a template file 31 encrypt1-res.xml An example template file for encrypt1.c 32 encrypt1-tmpl.xml The result of processing encrypt1_tmpl.xml by encrypt1.c 33 encrypt2.c Encrypting XML file using a dynamicaly created template 34 encrypt2-doc.xml An example XML file for encryption by encrypt2.c 35 encrypt2-res.xml The result of encryptin encrypt2-doc.xml by encrypt2.c 36 encrypt2.c Encrypting XML file using a session DES key 37 encrypt2-doc.xml An example XML file for encryption by encrypt3.c 38 encrypt2-res.xml The result of encryptin encrypt3-doc.xml by encrypt3.c 39 decrypt1.c Decrypting binary data using a single key 40 decrypt2.c Decrypting binary data using keys manager 41 decrypt3.c Decrypting binary file using custom keys manager 42 xmldsigverify.c CGI script for signatures verifications 43 442. Building Examples 45------------------------- 46 47Unixes: 48 Just run the usual 'make' command (assuming that xmlsec, libxml and 49 all other required libraries are already installed). 50 51Windows: 52 - Add paths to include and library files for xmlsec, libxml2, libexslt and 53 openssl or nss to the environment variables INCLUDE and LIB. 54 - Edit 'Makefile.w32' file and specify correct crypto engine (openssl or 55 nss for now). You can also specify necessary include and library paths 56 or change from static linking to using DLLs. 57 - Run 'nmake -f Makefile.w32' 58 59 If something does not work, check the README file in the top level 60 "win32" folder and have fun :) 61 62Other platforms: 63 If none of the above works for you and you've managed to compile xmlsec 64 library by yourself then you probably know what to do. 65 66 67 683. Runnning Examples. 69------------------------- 70 71The following are just examples and you can use the programs from this 72folder with any other input files: 73 74 ./sign1 sign1-tmpl.xml rsakey.pem 75 ./sign2 sign2-doc.xml rsakey.pem 76 ./sign3 sign3-doc.xml rsakey.pem rsacert.pem 77 78 ./verify1 sign1-res.xml rsapub.pem 79 ./verify1 sign2-res.xml rsapub.pem 80 ./verify2 sign1-res.xml rsapub.pem 81 ./verify2 sign2-res.xml rsapub.pem 82 ./verify3 sign3-res.xml ca2cert.pem cacert.pem 83 ./verify4 verify4-res.xml ca2cert.pem cacert.pem 84 85 ./encrypt1 encrypt1-tmpl.xml deskey.bin 86 ./encrypt2 encrypt2-doc.xml deskey.bin 87 ./encrypt3 encrypt3-doc.xml rsakey.pem 88 89 ./decrypt1 encrypt1-res.xml deskey.bin 90 ./decrypt1 encrypt2-res.xml deskey.bin 91 ./decrypt2 encrypt1-res.xml deskey.bin 92 ./decrypt2 encrypt2-res.xml deskey.bin 93 ./decrypt3 encrypt1-res.xml 94 ./decrypt3 encrypt2-res.xml 95 ./decrypt3 encrypt3-res.xml 96 974. Using xmlsec command line tool. 98------------------------- 99For Windows, use "xmlsec" instead of "xmlsec1": 100 101 xmlsec1 sign --privkey rsakey.pem --output sign1.xml sign1-tmpl.xml 102 xmlsec1 verify --pubkey rsapub.pem sign1.xml 103 xmlsec1 verify --pubkey rsapub.pem sign1-res.xml 104 xmlsec1 verify --pubkey rsapub.pem sign2-res.xml 105 xmlsec1 verify --trusted ca2cert.pem --trusted cacert.pem sign3-res.xml 106 xmlsec1 verify --trusted ca2cert.pem --trusted cacert.pem verify4-res.xml 107 108 xmlsec1 encrypt --deskey deskey.bin --binary-data binary.dat --output encrypt1.xml encrypt1-tmpl.xml 109 xmlsec1 decrypt --deskey deskey.bin encrypt1.xml 110 xmlsec1 decrypt --deskey deskey.bin encrypt1-res.xml 111 xmlsec1 decrypt --deskey deskey.bin encrypt2-res.xml 112 xmlsec1 decrypt --privkey rsakey.pem encrypt3-res.xml 113 114 115