Size: 457
Comment:
|
Size: 1663
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
* https://users.dcc.uchile.cl/~pcamacho/tutorial/web/xmlsec/xmlsec.html | |
Line 15: | Line 16: |
== Sign with certificate test.xml == * openssl req -new -x509 -days 3650 -nodes -out cert.pem -keyout privkey.pem * xmlsec1 --sign --privkey-pem privkey.pem --output test_signed.xml test.xml * xmlsec1 --verify test_signed.xml === test.xml === {{{#!highlight xml <a> <b Id="tosign"> <c>test</c> </b> <!-- signature template --> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm= "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/> <SignatureMethod Algorithm= "http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <Reference URI=""> <Transforms> <Transform Algorithm= "http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> </Transforms> <DigestMethod Algorithm= "http://www.w3.org/2000/09/xmldsig#sha1"/> <DigestValue></DigestValue> </Reference> </SignedInfo> <SignatureValue /> <KeyInfo> <X509Data > <X509SubjectName/> <X509IssuerSerial/> <X509Certificate/> </X509Data> <KeyValue /> </KeyInfo> </Signature> </a> }}} |
xmlsec
XML Security Library is a C library based on LibXML2. The library supports major XML security standards:
Slackbuild
Sign with certificate test.xml
- openssl req -new -x509 -days 3650 -nodes -out cert.pem -keyout privkey.pem
- xmlsec1 --sign --privkey-pem privkey.pem --output test_signed.xml test.xml
- xmlsec1 --verify test_signed.xml
test.xml
1 <a>
2 <b Id="tosign">
3 <c>test</c>
4 </b>
5 <!-- signature template -->
6 <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
7 <SignedInfo>
8 <CanonicalizationMethod Algorithm=
9 "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
10 <SignatureMethod Algorithm=
11 "http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
12 <Reference URI="">
13 <Transforms>
14 <Transform Algorithm=
15 "http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
16 </Transforms>
17 <DigestMethod Algorithm=
18 "http://www.w3.org/2000/09/xmldsig#sha1"/>
19 <DigestValue></DigestValue>
20 </Reference>
21 </SignedInfo>
22 <SignatureValue />
23 <KeyInfo>
24 <X509Data >
25 <X509SubjectName/>
26 <X509IssuerSerial/>
27 <X509Certificate/>
28 </X509Data>
29 <KeyValue />
30 </KeyInfo>
31 </Signature>
32 </a>