File: README.md

package info (click to toggle)
xmlsec1 1.3.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,916 kB
  • sloc: ansic: 100,493; xml: 19,156; sh: 8,079; makefile: 1,186; javascript: 438; perl: 199
file content (254 lines) | stat: -rw-r--r-- 6,083 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# XMLSec Library: Examples

This folder contains XML Security Library examples.

## Building examples

### Unixes
Just run the usual `make` command (assuming that xmlsec, libxml2, libxslt and
all other required libraries are already installed).

### Windows
- Add paths to include and library files for xmlsec, libxml2, libxslt and
openssl or nss to the environment variables INCLUDE and LIB.
- Edit `Makefile.w32` file and specify correct crypto engine (openssl or
nss for now). You can also specify necessary include and library paths
or change from static linking to using DLLs.
- Run `nmake -f Makefile.w32`

If something does not work, check the README file in the top level
`win32` folder for additional instructions.

## Examples

### sign1: signing with a template file

Files:
```
sign1.c             The source code
sign1-tmpl.xml      The template file for sign1 example
sign1-res.xml       The result of processing sign1_tmpl.xml by sign1.c
```

To run this example:
```
./sign1 sign1-tmpl.xml rsakey.pem
```

To sign a template file with `xmlsec1` command line utility (use `xmlsec` on Windows):
```
xmlsec1 sign --privkey rsakey.pem --output sign1.xml sign1-tmpl.xml
```

### sign2: signing a file with a dynamicaly created template

Files:
```
sign2.c             The source code
sign2-doc.xml       An example XML file for signing by sign2.c
sign2-res.xml       The result of signing sign2-doc.xml by sign2.c
```

To run this example:
```
./sign2 sign2-doc.xml rsakey.pem
```

### sign3: signing a file with a dynamicaly created template and an X509 certificate

Files:
```
sign3.c             The source code
sign3-doc.xml       An example XML file for signing by sign3.c
sign3-res.xml       The result of signing sign3-doc.xml by sign3.c
```

To run this example:
```
./sign3 sign3-doc.xml rsakey.pem rsacert.pem
```

### verify1: verifying a signed document with a public key

Files:
```
verify1.c           The source code
```

To run this example:
```
./verify1 sign1-res.xml rsapub.pem
./verify1 sign2-res.xml rsapub.pem
```

### verify2: verifying a signed document using keys manager

Files:
```
verify2.c           The source code
```

To run this example:
```
./verify2 sign1-res.xml rsapub.pem
./verify2 sign2-res.xml rsapub.pem
```

To verify a signed document with `xmlsec1` command line utility (use `xmlsec` on Windows):
```
xmlsec1 verify --pubkey rsapub.pem sign1-res.xml
xmlsec1 verify --pubkey rsapub.pem sign2-res.xml
```

### verify3: verifying a signed document using X509 certificate

Files:
```
verify3.c           The source code
```

To run this example:
```
./verify3 sign3-res.xml ca2cert.pem cacert.pem
```

To verify a signed document using X509 certificate with `xmlsec1` command line
utility (use `xmlsec` on Windows):
```
xmlsec1 verify --trusted ca2cert.pem --trusted cacert.pem sign3-res.xml
```

### verify4: verifying a simple SAML response using X509 certificate

Files:
```
verify4.c           The source code
verify4-tmpl.xml    An example template file with a simple SAML response for verify4 example
verify4-res.xml     Signed simple SAML response for verification by verify4.c
```

To run this example:
```
./verify4 verify4-res.xml ca2cert.pem cacert.pem
```

To verify a signed SAML response using X509 certificate with `xmlsec1` command line
utility (use `xmlsec` on Windows):
```
xmlsec1 verify --trusted ca2cert.pem --trusted cacert.pem verify4-res.xml
```

### encrypt1: encrypting binary data with a template file

Files:
```
encrypt1.c          The source code
encrypt1-res.xml    An example template file for encrypt1.c
encrypt1-tmpl.xml   The result of processing encrypt1_tmpl.xml by encrypt1.c
```

To run this example:
```
./encrypt1 encrypt1-tmpl.xml deskey.bin
```

To encrypt binary data with a template file with `xmlsec1` command line
utility (use `xmlsec` on Windows):
```
xmlsec1 encrypt --deskey deskey.bin  --binary-data binary.dat --output encrypt1.xml encrypt1-tmpl.xml
```

### encrypt2: encrypting XML file using a dynamicaly created template

Files:
```
encrypt2.c          The source code
encrypt2-doc.xml    An example XML file for encryption by encrypt2.c
encrypt2-res.xml    The result of encryptin encrypt2-doc.xml by encrypt2.c
```

To run this example:
```
./encrypt2 encrypt2-doc.xml deskey.bin
```

### encrypt3: encrypting XML file using a session DES key

Files:
```
encrypt3.c          The source code
encrypt3-doc.xml    An example XML file for encryption by encrypt3.c
encrypt3-res.xml    The result of encryptin encrypt3-doc.xml by encrypt3.c
```

To run this example:
```
./encrypt3 encrypt3-doc.xml rsakey.pem
```

### decrypt1: decrypting binary data using a single key

Files:
```
decrypt1.c          The source code
```

To run this example:
```
./decrypt1 encrypt1-res.xml deskey.bin
./decrypt1 encrypt2-res.xml deskey.bin
```

### decrypt2: decrypting binary data using keys manager

Files:
```
decrypt2.c          The source code
```

To run this example:
```
./decrypt2 encrypt1-res.xml deskey.bin
./decrypt2 encrypt2-res.xml deskey.bin
```

To decrypt binary data with `xmlsec1` command line utility (use `xmlsec` on Windows):
```
xmlsec1 decrypt --deskey deskey.bin encrypt1-res.xml
xmlsec1 decrypt --deskey deskey.bin encrypt2-res.xml
xmlsec1 decrypt --privkey rsakey.pem encrypt3-res.xml
```

### decrypt3: decrypting binary file using custom keys manager

Files:
```
decrypt3.c          The source code
```

To run this example:
```
./decrypt3 encrypt1-res.xml
./decrypt3 encrypt2-res.xml
./decrypt3 encrypt3-res.xml
```

### xmldsigverify: CGI script for signatures verifications

Files:
```
xmldsigverify.c     The source code
```

To run this example, install compiled xmldsigverify script into
your web server cgi-bin directory.

### Keys and certificates
```
cacert.pem          Root (trusted) certificate
ca2cert.pem         CA (trusted) certificate (signed with cacert.pem)
rsakey.pem          Private PEM key file
rsapub.pem          Public PEM key file
rsacert.pem         Certificate for rsakey.pem signed with ca2cert.pem
deskey.bin          A DES keys
```