summaryrefslogtreecommitdiff
path: root/docs/api/xmlsec-examples-sign-x509.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api/xmlsec-examples-sign-x509.html')
-rw-r--r--docs/api/xmlsec-examples-sign-x509.html110
1 files changed, 61 insertions, 49 deletions
diff --git a/docs/api/xmlsec-examples-sign-x509.html b/docs/api/xmlsec-examples-sign-x509.html
index 796c5f67..9f07b379 100644
--- a/docs/api/xmlsec-examples-sign-x509.html
+++ b/docs/api/xmlsec-examples-sign-x509.html
@@ -36,8 +36,31 @@
.navigation .title {
font-size: 200%;
}</style>
+<style type="text/css">
+table.CALSTABLE > tbody > tr:nth-child(1) > td:nth-child(1) {
+ width: 20em;
+}
+.synopsis, .classsynopsis {
+ background: #eeeeee;
+ border: solid 1px #aaaaaa;
+}
+.programlisting {
+ background: #eeeeee;
+ border: solid 1px #000000;
+}
+.navigation {
+ background: #eeeeee;
+ border: solid 1px #000000;
+}
+.navigation a {
+ color: initial;
+}
+.navigation a:visited {
+ color: initial;
+}
+</style>
</head>
-<body><table witdh="100%" valign="top"><tr valign="top">
+<body><table width="100%" valign="top"><tr valign="top">
<td valign="top" align="left" width="210">
<img src="../images/logo.gif" alt="XML Security Library" border="0"><p></p>
<ul>
@@ -78,11 +101,11 @@
</td>
<td valign="top"><table width="100%" valign="top"><tr><td valign="top" align="left" id="xmlsecContent">
<table width="100%" class="navigation" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
-<td><a accesskey="p" href="xmlsec-examples-sign-dynamimc-template.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
-<td><a accesskey="u" href="xmlsec-examples.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
-<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<td><a accesskey="p" href="xmlsec-examples-sign-dynamimc-template.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="xmlsec-examples.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<th width="100%" align="center">XML Security Library Reference Manual</th>
-<td><a accesskey="n" href="xmlsec-verify-with-key.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="xmlsec-verify-with-key.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<br clear="all"><div class="SECT1">
<h1 class="SECT1"><a name="XMLSEC-EXAMPLES-SIGN-X509">Signing with X509 certificate.</a></h1>
@@ -91,13 +114,13 @@
<p></p>
<div class="INFORMALEXAMPLE">
<p></p>
-<a name="AEN684"></a><pre class="PROGRAMLISTING">/**
+<a name="AEN833"></a><pre class="PROGRAMLISTING">/**
* XML Security Library example: Signing a file with a dynamicaly created template and an X509 certificate.
*
* Signs a file using a dynamicaly created template, key from PEM file and
* an X509 certificate. The signature has one reference with one enveloped
- * transform to sign the whole document except the &lt;dsig:Signature/&gt; node
- * itself. The key certificate is written in the &lt;dsig:X509Data/&gt; node.
+ * transform to sign the whole document except the <a href="http://www.w3.org/TR/xmldsig-core/#sec-Signature" target="_top">&lt;dsig:Signature/&gt;</a> node
+ * itself. The key certificate is written in the <a href="http://www.w3.org/TR/xmldsig-core/#sec-X509Data" target="_top">&lt;dsig:X509Data/&gt;</a> node.
*
* This example was developed and tested with OpenSSL crypto library. The
* certificates management policies for another crypto library may break it.
@@ -109,12 +132,12 @@
* ./sign3 sign3-doc.xml rsakey.pem rsacert.pem &gt; sign3-res.xml
*
* The result signature could be validated using verify3 example:
- * ./verify3 sign3-res.xml rootcert.pem
+ * ./verify3 sign3-res.xml ca2cert.pem cacert.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
*
- * Copyright (C) 2002-2003 Aleksey Sanin &lt;aleksey@aleksey.com&gt;
+ * Copyright (C) 2002-2016 Aleksey Sanin &lt;aleksey@aleksey.com&gt;
*/
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
@@ -241,7 +264,7 @@ main(int argc, char **argv) {
*
* Signs the @xml_file using private key from @key_file and dynamicaly
* created enveloped signature template. The certificate from @cert_file
- * is placed in the &lt;dsig:X509Data/&gt; node.
+ * is placed in the <a href="http://www.w3.org/TR/xmldsig-core/#sec-X509Data" target="_top">&lt;dsig:X509Data/&gt;</a> node.
*
* Returns 0 on success or a negative value if an error occurs.
*/
@@ -273,7 +296,7 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) {
goto done;
}
- /* add &lt;dsig:Signature/&gt; node to the doc */
+ /* add <a href="http://www.w3.org/TR/xmldsig-core/#sec-Signature" target="_top">&lt;dsig:Signature/&gt;</a> node to the doc */
xmlAddChild(xmlDocGetRootElement(doc), signNode);
/* add reference */
@@ -290,7 +313,7 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) {
goto done;
}
- /* add &lt;dsig:KeyInfo/&gt; and &lt;dsig:X509Data/&gt; */
+ /* add <a href="http://www.w3.org/TR/xmldsig-core/#sec-KeyInfo" target="_top">&lt;dsig:KeyInfo/&gt;</a> and <a href="http://www.w3.org/TR/xmldsig-core/#sec-X509Data" target="_top">&lt;dsig:X509Data/&gt;</a> */
keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
if(keyInfoNode == NULL) {
fprintf(stderr, "Error: failed to add key info\n");
@@ -359,7 +382,7 @@ done:
<p></p>
<div class="INFORMALEXAMPLE">
<p></p>
-<a name="AEN689"></a><pre class="PROGRAMLISTING">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+<a name="AEN844"></a><pre class="PROGRAMLISTING">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!--
XML Security Library example: Original XML doc file for sign3 example.
--&gt;
@@ -376,9 +399,9 @@ XML Security Library example: Original XML doc file for sign3 example.
<p></p>
<div class="INFORMALEXAMPLE">
<p></p>
-<a name="AEN694"></a><pre class="PROGRAMLISTING">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+<a name="AEN849"></a><pre class="PROGRAMLISTING">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!--
-XML Security Library example: Signed XML doc file (sign3 example).
+XML Security Library example: Original XML doc file for sign3 example.
--&gt;
&lt;Envelope xmlns="urn:envelope"&gt;
&lt;Data&gt;
@@ -396,41 +419,30 @@ XML Security Library example: Signed XML doc file (sign3 example).
&lt;DigestValue&gt;HjY8ilZAIEM2tBbPn5mYO1ieIX4=&lt;/DigestValue&gt;
&lt;/Reference&gt;
&lt;/SignedInfo&gt;
-&lt;SignatureValue&gt;SIaj/6KY3C1SmDXU2++Gm31U1xTadFp04WhBgfsJFbxrL+q7GKSKN9kfQ+UpN9+i
-D5fWmuavXEHe4Gw6RMaMEkq2URQo7F68+d5J/ajq8/l4n+xE6/reGScVwT6L4dEP
-XXVJcAi2ZnQ3O7GTNvNGCPibL9mUcyCWBFZ92Uemtc/vJFCQ7ZyKMdMfACgxOwyN
-T/9971oog241/2doudhonc0I/3mgPYWkZdX6yvr62mEjnG+oUZkhWYJ4ewZJ4hM4
-JjbFqZO+OEzDRSbw3DkmuBA/mtlx+3t13SESfEub5hqoMdVmtth/eTb64dsPdl9r
-3k1ACVX9f8aHfQQdJOmLFQ==&lt;/SignatureValue&gt;
+&lt;SignatureValue&gt;GnYgZdzPeXd/gPTJmQ506qmxWkd3VK1Y23kh5Qpq8y4LMNY+LJJeCWK5wpo/vufR
+nIH/KUqvIvtk9nb2IjF5Uw==&lt;/SignatureValue&gt;
&lt;KeyInfo&gt;
&lt;X509Data&gt;
-&lt;X509Certificate&gt;MIIE3zCCBEigAwIBAgIBBTANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCVVMx
-EzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVN1bm55dmFsZTE9MDsGA1UE
-ChM0WE1MIFNlY3VyaXR5IExpYnJhcnkgKGh0dHA6Ly93d3cuYWxla3NleS5jb20v
-eG1sc2VjKTEZMBcGA1U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