diff options
9 files changed, 1296 insertions, 64 deletions
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/fix-ltmain.sh.patch b/meta-oe/recipes-support/xmlsec1/xmlsec1/0001-force-to-use-our-own-libtool.patch index 73c6ddb027..57c0ab36ff 100644 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1/fix-ltmain.sh.patch +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/0001-force-to-use-our-own-libtool.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 1b9701faf22f5a17a81a2a2732794d9627499fcb Mon Sep 17 00:00:00 2001 | 1 | From 37efc0ca231363aa9161c036ba12cc2b33f51a24 Mon Sep 17 00:00:00 2001 |
| 2 | From: Yulong Pei <Yulong.pei@windriver.com> | 2 | From: Yulong Pei <Yulong.pei@windriver.com> |
| 3 | Date: Thu, 21 Jan 2010 14:11:20 +0800 | 3 | Date: Thu, 21 Jan 2010 14:11:20 +0800 |
| 4 | Subject: [PATCH] force to use our own libtool | 4 | Subject: [PATCH] force to use our own libtool |
| @@ -6,16 +6,15 @@ Subject: [PATCH] force to use our own libtool | |||
| 6 | Upstream-Status: Inappropriate [ OE specific ] | 6 | Upstream-Status: Inappropriate [ OE specific ] |
| 7 | 7 | ||
| 8 | Signed-off-by: Yulong Pei <Yulong.pei@windriver.com> | 8 | Signed-off-by: Yulong Pei <Yulong.pei@windriver.com> |
| 9 | |||
| 10 | --- | 9 | --- |
| 11 | ltmain.sh | 2 +- | 10 | ltmain.sh | 2 +- |
| 12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 13 | 12 | ||
| 14 | diff --git a/ltmain.sh b/ltmain.sh | 13 | diff --git a/ltmain.sh b/ltmain.sh |
| 15 | index 1dea62a..bfb9784 100755 | 14 | index 7271130e..4e0925a6 100755 |
| 16 | --- a/ltmain.sh | 15 | --- a/ltmain.sh |
| 17 | +++ b/ltmain.sh | 16 | +++ b/ltmain.sh |
| 18 | @@ -7225,7 +7225,7 @@ func_mode_link () | 17 | @@ -7377,7 +7377,7 @@ func_mode_link () |
| 19 | dir=$func_resolve_sysroot_result | 18 | dir=$func_resolve_sysroot_result |
| 20 | # We need an absolute path. | 19 | # We need an absolute path. |
| 21 | case $dir in | 20 | case $dir in |
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/change-finding-path-of-nss.patch b/meta-oe/recipes-support/xmlsec1/xmlsec1/0002-change-finding-path-of-nss-and-nspr.patch index 61c56ffc8b..4a30f483a2 100644 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1/change-finding-path-of-nss.patch +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/0002-change-finding-path-of-nss-and-nspr.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From b43fa6bf612ee59db57573b39e357b6ca96d48b6 Mon Sep 17 00:00:00 2001 | 1 | From 75d7dc918771483a6c4354ee77bc14c2ff83f467 Mon Sep 17 00:00:00 2001 |
| 2 | From: Yulong Pei <Yulong.pei@windriver.com> | 2 | From: Yulong Pei <Yulong.pei@windriver.com> |
| 3 | Date: Wed, 21 Jul 2010 22:33:43 +0800 | 3 | Date: Wed, 21 Jul 2010 22:33:43 +0800 |
| 4 | Subject: [PATCH] change finding path of nss and nspr | 4 | Subject: [PATCH] change finding path of nss and nspr |
| @@ -13,10 +13,10 @@ Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | |||
| 13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 14 | 14 | ||
| 15 | diff --git a/configure.ac b/configure.ac | 15 | diff --git a/configure.ac b/configure.ac |
| 16 | index 8add879..7f137c0 100644 | 16 | index b31b8bb6..b59acc86 100644 |
| 17 | --- a/configure.ac | 17 | --- a/configure.ac |
| 18 | +++ b/configure.ac | 18 | +++ b/configure.ac |
| 19 | @@ -933,7 +933,7 @@ NSS_PACKAGE=mozilla-nss | 19 | @@ -965,7 +965,7 @@ NSS_PACKAGE=mozilla-nss |
| 20 | NSPR_INCLUDE_MARKER="nspr/nspr.h" | 20 | NSPR_INCLUDE_MARKER="nspr/nspr.h" |
| 21 | NSPR_LIB_MARKER="libnspr4$shrext" | 21 | NSPR_LIB_MARKER="libnspr4$shrext" |
| 22 | NSPR_LIBS_LIST="-lnspr4 -lplds4 -lplc4" | 22 | NSPR_LIBS_LIST="-lnspr4 -lplds4 -lplc4" |
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/makefile-ptest.patch b/meta-oe/recipes-support/xmlsec1/xmlsec1/0003-xmlsec1-add-new-recipe.patch index 55ae9887f2..1b50e2ed0e 100644 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1/makefile-ptest.patch +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/0003-xmlsec1-add-new-recipe.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 83a1381e1d6bd1b5ec3df6f7c4bc1f4fe4f860b6 Mon Sep 17 00:00:00 2001 | 1 | From 2e66dbeeec7d75ed86c87b83b3ac300257363c04 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jackie Huang <jackie.huang@windriver.com> | 2 | From: Jackie Huang <jackie.huang@windriver.com> |
| 3 | Date: Thu, 15 Jun 2017 14:44:01 +0800 | 3 | Date: Thu, 15 Jun 2017 14:44:01 +0800 |
| 4 | Subject: [PATCH] xmlsec1: add new recipe | 4 | Subject: [PATCH] xmlsec1: add new recipe |
| @@ -14,7 +14,7 @@ Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | |||
| 14 | 1 file changed, 10 insertions(+), 2 deletions(-) | 14 | 1 file changed, 10 insertions(+), 2 deletions(-) |
| 15 | 15 | ||
| 16 | diff --git a/examples/Makefile b/examples/Makefile | 16 | diff --git a/examples/Makefile b/examples/Makefile |
| 17 | index 0b352bc..de3c217 100644 | 17 | index c6a25f09..3da1cb33 100644 |
| 18 | --- a/examples/Makefile | 18 | --- a/examples/Makefile |
| 19 | +++ b/examples/Makefile | 19 | +++ b/examples/Makefile |
| 20 | @@ -12,9 +12,17 @@ PROGRAMS = \ | 20 | @@ -12,9 +12,17 @@ PROGRAMS = \ |
| @@ -37,6 +37,3 @@ index 0b352bc..de3c217 100644 | |||
| 37 | 37 | ||
| 38 | all: $(PROGRAMS) | 38 | all: $(PROGRAMS) |
| 39 | 39 | ||
| 40 | -- | ||
| 41 | 2.43.0 | ||
| 42 | |||
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/xmlsec1-examples-allow-build-in-separate-dir.patch b/meta-oe/recipes-support/xmlsec1/xmlsec1/0004-examples-allow-build-in-separate-dir.patch index 50706793b2..d7188083b3 100644 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1/xmlsec1-examples-allow-build-in-separate-dir.patch +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/0004-examples-allow-build-in-separate-dir.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 0c38c6864e7ba8f53a657d87894f24374a6a4932 Mon Sep 17 00:00:00 2001 | 1 | From fab6503dca2046d32fa186c33c566c58110334a5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jackie Huang <jackie.huang@windriver.com> | 2 | From: Jackie Huang <jackie.huang@windriver.com> |
| 3 | Date: Tue, 30 Dec 2014 11:18:17 +0800 | 3 | Date: Tue, 30 Dec 2014 11:18:17 +0800 |
| 4 | Subject: [PATCH] examples: allow build in separate dir | 4 | Subject: [PATCH] examples: allow build in separate dir |
| @@ -11,7 +11,7 @@ Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | |||
| 11 | 1 file changed, 4 insertions(+), 2 deletions(-) | 11 | 1 file changed, 4 insertions(+), 2 deletions(-) |
| 12 | 12 | ||
| 13 | diff --git a/examples/Makefile b/examples/Makefile | 13 | diff --git a/examples/Makefile b/examples/Makefile |
| 14 | index de3c217..2e0ab6e 100644 | 14 | index 3da1cb33..ff44cb7b 100644 |
| 15 | --- a/examples/Makefile | 15 | --- a/examples/Makefile |
| 16 | +++ b/examples/Makefile | 16 | +++ b/examples/Makefile |
| 17 | @@ -16,8 +16,10 @@ ifndef CC | 17 | @@ -16,8 +16,10 @@ ifndef CC |
| @@ -27,6 +27,3 @@ index de3c217..2e0ab6e 100644 | |||
| 27 | 27 | ||
| 28 | DESTDIR = /usr/share/xmlsec1 | 28 | DESTDIR = /usr/share/xmlsec1 |
| 29 | install-ptest: | 29 | install-ptest: |
| 30 | -- | ||
| 31 | 2.43.0 | ||
| 32 | |||
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/0001-nss-nspr-fix-for-multilib.patch b/meta-oe/recipes-support/xmlsec1/xmlsec1/0005-nss-nspr-fix-for-multilib.patch index 9bb017b63b..a1cc4fd559 100644 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1/0001-nss-nspr-fix-for-multilib.patch +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/0005-nss-nspr-fix-for-multilib.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 1d7c01467e6f510b5636c73757f302a4bd277a3c Mon Sep 17 00:00:00 2001 | 1 | From 9f1e319a5f7dcbe611d1f41a551f644c293ac3f0 Mon Sep 17 00:00:00 2001 |
| 2 | From: Chen Qi <Qi.Chen@windriver.com> | 2 | From: Chen Qi <Qi.Chen@windriver.com> |
| 3 | Date: Tue, 4 Feb 2020 23:39:49 -0800 | 3 | Date: Tue, 4 Feb 2020 23:39:49 -0800 |
| 4 | Subject: [PATCH] nss/nspr: fix for multilib | 4 | Subject: [PATCH] nss/nspr: fix for multilib |
| @@ -11,10 +11,10 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | |||
| 11 | 1 file changed, 8 insertions(+), 8 deletions(-) | 11 | 1 file changed, 8 insertions(+), 8 deletions(-) |
| 12 | 12 | ||
| 13 | diff --git a/configure.ac b/configure.ac | 13 | diff --git a/configure.ac b/configure.ac |
| 14 | index 40e9c0d..8f42d4d 100644 | 14 | index b59acc86..b8b0542d 100644 |
| 15 | --- a/configure.ac | 15 | --- a/configure.ac |
| 16 | +++ b/configure.ac | 16 | +++ b/configure.ac |
| 17 | @@ -966,24 +966,24 @@ fi | 17 | @@ -990,24 +990,24 @@ fi |
| 18 | dnl Priority 1: User specifies the path to installation | 18 | dnl Priority 1: User specifies the path to installation |
| 19 | if test "z$NSPR_FOUND" = "zno" -a "z$with_nspr" != "z" -a "z$with_nspr" != "zyes" ; then | 19 | if test "z$NSPR_FOUND" = "zno" -a "z$with_nspr" != "z" -a "z$with_nspr" != "zyes" ; then |
| 20 | AC_MSG_CHECKING(for nspr library installation in "$with_nspr" folder) | 20 | AC_MSG_CHECKING(for nspr library installation in "$with_nspr" folder) |
| @@ -47,6 +47,3 @@ index 40e9c0d..8f42d4d 100644 | |||
| 47 | fi | 47 | fi |
| 48 | fi | 48 | fi |
| 49 | 49 | ||
| 50 | -- | ||
| 51 | 2.43.0 | ||
| 52 | |||
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/ensure-search-path-non-host.patch b/meta-oe/recipes-support/xmlsec1/xmlsec1/0006-xmlsec1-Fix-configure-QA-error-caused-by-host-lookup.patch index 7b07628e5f..de2534ef78 100644 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1/ensure-search-path-non-host.patch +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/0006-xmlsec1-Fix-configure-QA-error-caused-by-host-lookup.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From c16d384fb64cf53351e150fb9e9b99cc6ba970b2 Mon Sep 17 00:00:00 2001 | 1 | From 67642a6bbf7261626f41b84cccf9b55b93c4cbc9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Anatol Belski <anbelski@linux.microsoft.com> | 2 | From: Anatol Belski <anbelski@linux.microsoft.com> |
| 3 | Date: Thu, 14 Jan 2021 17:36:23 +0000 | 3 | Date: Thu, 14 Jan 2021 17:36:23 +0000 |
| 4 | Subject: [PATCH] xmlsec1: Fix configure QA error caused by host lookup path | 4 | Subject: [PATCH] xmlsec1: Fix configure QA error caused by host lookup path |
| @@ -9,16 +9,15 @@ It will eventually arise after the configure QA as the configure script should o | |||
| 9 | 9 | ||
| 10 | Upstream-Status: Inappropriate [embedded specific] | 10 | Upstream-Status: Inappropriate [embedded specific] |
| 11 | Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com> | 11 | Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com> |
| 12 | |||
| 13 | --- | 12 | --- |
| 14 | configure.ac | 4 ++-- | 13 | configure.ac | 4 ++-- |
| 15 | 1 file changed, 2 insertions(+), 2 deletions(-) | 14 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 16 | 15 | ||
| 17 | diff --git a/configure.ac b/configure.ac | 16 | diff --git a/configure.ac b/configure.ac |
| 18 | index 3d23683..baf27b7 100644 | 17 | index b8b0542d..795355af 100644 |
| 19 | --- a/configure.ac | 18 | --- a/configure.ac |
| 20 | +++ b/configure.ac | 19 | +++ b/configure.ac |
| 21 | @@ -286,8 +286,8 @@ fi | 20 | @@ -306,8 +306,8 @@ fi |
| 22 | dnl ========================================================================== | 21 | dnl ========================================================================== |
| 23 | dnl Common installation locations | 22 | dnl Common installation locations |
| 24 | dnl ========================================================================== | 23 | dnl ========================================================================== |
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/0007-xmlsec-examples-Fix-LibXML2-deprecation-warnings-and.patch b/meta-oe/recipes-support/xmlsec1/xmlsec1/0007-xmlsec-examples-Fix-LibXML2-deprecation-warnings-and.patch new file mode 100644 index 0000000000..156c7d8402 --- /dev/null +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/0007-xmlsec-examples-Fix-LibXML2-deprecation-warnings-and.patch | |||
| @@ -0,0 +1,1190 @@ | |||
| 1 | From b68f4aa1d450b1a940dd950e1e5eadc2c91ac82f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: lsh123 <aleksey@aleksey.com> | ||
| 3 | Date: Sat, 15 Nov 2025 09:38:02 -0800 | ||
| 4 | Subject: [PATCH] (xmlsec-examples) Fix LibXML2 deprecation warnings and update | ||
| 5 | README to show key name use (#990) | ||
| 6 | |||
| 7 | See https://github.com/lsh123/xmlsec/issues/989 | ||
| 8 | |||
| 9 | Upstream-Status: Backport | ||
| 10 | (cherry picked from commit f15b6dcb5276facfbdbcd8dfe1f23026aa079e7a) | ||
| 11 | Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> | ||
| 12 | --- | ||
| 13 | docs/xmldsig-verifier.html | 5 +- | ||
| 14 | examples/Makefile | 3 +- | ||
| 15 | examples/README.md | 40 +- | ||
| 16 | examples/decrypt1.c | 4 +- | ||
| 17 | examples/decrypt2.c | 4 +- | ||
| 18 | examples/decrypt3.c | 4 +- | ||
| 19 | examples/encrypt1-tmpl.xml | 8 +- | ||
| 20 | examples/encrypt1.c | 4 +- | ||
| 21 | examples/encrypt2.c | 4 +- | ||
| 22 | examples/encrypt3-res.xml | 8 +- | ||
| 23 | examples/encrypt3.c | 7 +- | ||
| 24 | examples/sign1-tmpl.xml | 6 +- | ||
| 25 | examples/sign1.c | 4 +- | ||
| 26 | examples/sign2.c | 4 +- | ||
| 27 | examples/sign3.c | 4 +- | ||
| 28 | examples/sign4.c | 4 +- | ||
| 29 | examples/verify-saml.c | 4 +- | ||
| 30 | examples/verify1.c | 4 +- | ||
| 31 | examples/verify2.c | 4 +- | ||
| 32 | examples/verify3.c | 2 - | ||
| 33 | examples/verify4.c | 2 - | ||
| 34 | examples/xmldsigverify.c | 379 ------------------ | ||
| 35 | .../aleksey-xmldsig-01/enveloped-gost2001.xml | 3 - | ||
| 36 | .../enveloped-x509-digest-sha1.tmpl | 3 - | ||
| 37 | .../enveloped-x509-digest-sha1.xml | 3 - | ||
| 38 | .../enveloped-x509-digest-sha224.tmpl | 3 - | ||
| 39 | .../enveloped-x509-digest-sha224.xml | 3 - | ||
| 40 | .../enveloped-x509-digest-sha256.tmpl | 3 - | ||
| 41 | .../enveloped-x509-digest-sha256.xml | 3 - | ||
| 42 | .../enveloped-x509-digest-sha384.tmpl | 3 - | ||
| 43 | .../enveloped-x509-digest-sha384.xml | 3 - | ||
| 44 | .../enveloped-x509-digest-sha512.tmpl | 3 - | ||
| 45 | .../enveloped-x509-digest-sha512.xml | 3 - | ||
| 46 | .../enveloped-x509-issuerserial.tmpl | 3 - | ||
| 47 | .../enveloped-x509-issuerserial.xml | 3 - | ||
| 48 | .../enveloped-x509-missing-cert.tmpl | 3 - | ||
| 49 | .../enveloped-x509-missing-cert.xml | 3 - | ||
| 50 | .../enveloped-x509-same-subj-cert.tmpl | 3 - | ||
| 51 | .../enveloped-x509-ski.tmpl | 3 - | ||
| 52 | .../aleksey-xmldsig-01/enveloped-x509-ski.xml | 3 - | ||
| 53 | .../enveloped-x509-subjectname.tmpl | 3 - | ||
| 54 | .../enveloped-x509-subjectname.xml | 3 - | ||
| 55 | 43 files changed, 46 insertions(+), 525 deletions(-) | ||
| 56 | delete mode 100644 examples/xmldsigverify.c | ||
| 57 | |||
| 58 | diff --git a/docs/xmldsig-verifier.html b/docs/xmldsig-verifier.html | ||
| 59 | index befd21a6..c8381e98 100644 | ||
| 60 | --- a/docs/xmldsig-verifier.html | ||
| 61 | +++ b/docs/xmldsig-verifier.html | ||
| 62 | @@ -47,11 +47,8 @@ | ||
| 63 | <div align="center"> | ||
| 64 | <h1>Online XML Digital Signature Verifer is retired as of October, 2022</h1> | ||
| 65 | </div> | ||
| 66 | -<p>If you are interested in verifying an XML Digital Signature, then you should consider using | ||
| 67 | + <p>If you are interested in verifying an XML Digital Signature, then you should consider using | ||
| 68 | <a href="xmlsec-man.html">the xmlsec command line tool</a>. | ||
| 69 | - The source code for the Online XML Digital Signature Verifer is available on | ||
| 70 | - <a href="https://github.com/lsh123/xmlsec/blob/master/examples/xmldsigverify.c">GitHub</a> and in the "examples/" | ||
| 71 | - folder of the source tarfile. | ||
| 72 | </p> | ||
| 73 | </td></tr></table></td> | ||
| 74 | </tr></table></body> | ||
| 75 | diff --git a/examples/Makefile b/examples/Makefile | ||
| 76 | index ff44cb7b..945f3dab 100644 | ||
| 77 | --- a/examples/Makefile | ||
| 78 | +++ b/examples/Makefile | ||
| 79 | @@ -9,8 +9,7 @@ PROGRAMS = \ | ||
| 80 | $(PROGRAMS_SIGN) \ | ||
| 81 | $(PROGRAMS_VERIFY) \ | ||
| 82 | $(PROGRAMS_ENC) \ | ||
| 83 | - $(PROGRAMS_DEC) \ | ||
| 84 | - xmldsigverify | ||
| 85 | + $(PROGRAMS_DEC) | ||
| 86 | |||
| 87 | ifndef CC | ||
| 88 | CC = gcc | ||
| 89 | diff --git a/examples/README.md b/examples/README.md | ||
| 90 | index f07a07cb..acf39c31 100644 | ||
| 91 | --- a/examples/README.md | ||
| 92 | +++ b/examples/README.md | ||
| 93 | @@ -35,9 +35,10 @@ To run this example: | ||
| 94 | ./sign1 sign1-tmpl.xml rsakey.pem | ||
| 95 | ``` | ||
| 96 | |||
| 97 | -To sign a template file with `xmlsec1` command line utility (use `xmlsec` on Windows): | ||
| 98 | +To sign a template file with `xmlsec1` command line utility (use `xmlsec` on Windows). | ||
| 99 | +Note that in this example we set KeyName to be the same as the filename of the private key: | ||
| 100 | ``` | ||
| 101 | -xmlsec1 sign --privkey rsakey.pem --output sign1.xml sign1-tmpl.xml | ||
| 102 | +xmlsec1 sign --privkey:rsakey.pem rsakey.pem --output sign1.xml sign1-tmpl.xml | ||
| 103 | ``` | ||
| 104 | |||
| 105 | ### sign2: signing a file with a dynamicaly created template | ||
| 106 | @@ -108,10 +109,11 @@ To run this example: | ||
| 107 | ./verify2 sign2-res.xml rsapub.pem | ||
| 108 | ``` | ||
| 109 | |||
| 110 | -To verify a signed document with `xmlsec1` command line utility (use `xmlsec` on Windows): | ||
| 111 | +To verify a signed document with `xmlsec1` command line utility (use `xmlsec` on Windows). | ||
| 112 | +Note that in this example we set KeyName to be the same as the filename of the private key: | ||
| 113 | ``` | ||
| 114 | -xmlsec1 verify --pubkey rsapub.pem sign1-res.xml | ||
| 115 | -xmlsec1 verify --pubkey rsapub.pem sign2-res.xml | ||
| 116 | +xmlsec1 verify --pubkey:rsakey.pem rsapub.pem sign1-res.xml | ||
| 117 | +xmlsec1 verify --pubkey:rsakey.pem rsapub.pem sign2-res.xml | ||
| 118 | ``` | ||
| 119 | |||
| 120 | ### verify3: verifying an enveloped signature using X509 certificate | ||
| 121 | @@ -185,9 +187,10 @@ To run this example: | ||
| 122 | ``` | ||
| 123 | |||
| 124 | To encrypt binary data with a template file with `xmlsec1` command line | ||
| 125 | -utility (use `xmlsec` on Windows): | ||
| 126 | +utility (use `xmlsec` on Windows). Note that in this example we set KeyName to be | ||
| 127 | +the same as the filename of the key: | ||
| 128 | ``` | ||
| 129 | -xmlsec1 encrypt --deskey deskey.bin --binary-data binary.dat --output encrypt1.xml encrypt1-tmpl.xml | ||
| 130 | +xmlsec1 encrypt --deskey:deskey.bin deskey.bin --binary-data binary.dat --output encrypt1.xml encrypt1-tmpl.xml | ||
| 131 | ``` | ||
| 132 | |||
| 133 | ### encrypt2: encrypting XML file using a dynamicaly created template | ||
| 134 | @@ -213,7 +216,8 @@ encrypt3-doc.xml An example XML file for encryption by encrypt3.c | ||
| 135 | encrypt3-res.xml The result of encryptin encrypt3-doc.xml by encrypt3.c | ||
| 136 | ``` | ||
| 137 | |||
| 138 | -To run this example: | ||
| 139 | +To run this example (note: we are using the private key here instead of the public | ||
| 140 | +key to make decrypt3 example work)): | ||
| 141 | ``` | ||
| 142 | ./encrypt3 encrypt3-doc.xml rsakey.pem | ||
| 143 | ``` | ||
| 144 | @@ -244,11 +248,13 @@ To run this example: | ||
| 145 | ./decrypt2 encrypt2-res.xml deskey.bin | ||
| 146 | ``` | ||
| 147 | |||
| 148 | -To decrypt binary data with `xmlsec1` command line utility (use `xmlsec` on Windows): | ||
| 149 | +To decrypt binary data with `xmlsec1` command line utility (use `xmlsec` on Windows). | ||
| 150 | +Note that in this example we set KeyName to be the same as the filename of the | ||
| 151 | +(private) key: | ||
| 152 | ``` | ||
| 153 | -xmlsec1 decrypt --deskey deskey.bin encrypt1-res.xml | ||
| 154 | -xmlsec1 decrypt --deskey deskey.bin encrypt2-res.xml | ||
| 155 | -xmlsec1 decrypt --privkey rsakey.pem encrypt3-res.xml | ||
| 156 | +xmlsec1 decrypt --deskey:deskey.bin deskey.bin encrypt1-res.xml | ||
| 157 | +xmlsec1 decrypt --deskey:deskey.bin deskey.bin encrypt2-res.xml | ||
| 158 | +xmlsec1 decrypt --privkey:rsakey.pem rsakey.pem encrypt3-res.xml | ||
| 159 | ``` | ||
| 160 | |||
| 161 | ### decrypt3: decrypting binary file using custom keys manager | ||
| 162 | @@ -265,16 +271,6 @@ To run this example: | ||
| 163 | ./decrypt3 encrypt3-res.xml | ||
| 164 | ``` | ||
| 165 | |||
| 166 | -### xmldsigverify: CGI script for signatures verifications | ||
| 167 | - | ||
| 168 | -Files: | ||
| 169 | -``` | ||
| 170 | -xmldsigverify.c The source code | ||
| 171 | -``` | ||
| 172 | - | ||
| 173 | -To run this example, install compiled xmldsigverify script into | ||
| 174 | -your web server cgi-bin directory. | ||
| 175 | - | ||
| 176 | ### Keys and certificates | ||
| 177 | ``` | ||
| 178 | cacert.pem Root (trusted) certificate | ||
| 179 | diff --git a/examples/decrypt1.c b/examples/decrypt1.c | ||
| 180 | index e069bd7a..c9d2ec38 100644 | ||
| 181 | --- a/examples/decrypt1.c | ||
| 182 | +++ b/examples/decrypt1.c | ||
| 183 | @@ -52,8 +52,6 @@ main(int argc, char **argv) { | ||
| 184 | /* Init libxml and libxslt libraries */ | ||
| 185 | xmlInitParser(); | ||
| 186 | LIBXML_TEST_VERSION | ||
| 187 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 188 | - xmlSubstituteEntitiesDefault(1); | ||
| 189 | |||
| 190 | /* Init libxslt */ | ||
| 191 | #ifndef XMLSEC_NO_XSLT | ||
| 192 | @@ -149,7 +147,7 @@ decrypt_file(const char* enc_file, const char* key_file) { | ||
| 193 | assert(key_file); | ||
| 194 | |||
| 195 | /* load template */ | ||
| 196 | - doc = xmlReadFile(enc_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 197 | + doc = xmlReadFile(enc_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 198 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 199 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file); | ||
| 200 | goto done; | ||
| 201 | diff --git a/examples/decrypt2.c b/examples/decrypt2.c | ||
| 202 | index 522af222..49be8e60 100644 | ||
| 203 | --- a/examples/decrypt2.c | ||
| 204 | +++ b/examples/decrypt2.c | ||
| 205 | @@ -55,8 +55,6 @@ main(int argc, char **argv) { | ||
| 206 | /* Init libxml and libxslt libraries */ | ||
| 207 | xmlInitParser(); | ||
| 208 | LIBXML_TEST_VERSION | ||
| 209 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 210 | - xmlSubstituteEntitiesDefault(1); | ||
| 211 | |||
| 212 | /* Init libxslt */ | ||
| 213 | #ifndef XMLSEC_NO_XSLT | ||
| 214 | @@ -232,7 +230,7 @@ decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) { | ||
| 215 | assert(enc_file); | ||
| 216 | |||
| 217 | /* load template */ | ||
| 218 | - doc = xmlReadFile(enc_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 219 | + doc = xmlReadFile(enc_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 220 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 221 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file); | ||
| 222 | goto done; | ||
| 223 | diff --git a/examples/decrypt3.c b/examples/decrypt3.c | ||
| 224 | index e24effc0..8fddfa70 100644 | ||
| 225 | --- a/examples/decrypt3.c | ||
| 226 | +++ b/examples/decrypt3.c | ||
| 227 | @@ -58,8 +58,6 @@ main(int argc, char **argv) { | ||
| 228 | /* Init libxml and libxslt libraries */ | ||
| 229 | xmlInitParser(); | ||
| 230 | LIBXML_TEST_VERSION | ||
| 231 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 232 | - xmlSubstituteEntitiesDefault(1); | ||
| 233 | |||
| 234 | /* Init libxslt */ | ||
| 235 | #ifndef XMLSEC_NO_XSLT | ||
| 236 | @@ -165,7 +163,7 @@ decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) { | ||
| 237 | assert(enc_file); | ||
| 238 | |||
| 239 | /* load template */ | ||
| 240 | - doc = xmlReadFile(enc_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 241 | + doc = xmlReadFile(enc_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 242 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 243 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file); | ||
| 244 | goto done; | ||
| 245 | diff --git a/examples/encrypt1-tmpl.xml b/examples/encrypt1-tmpl.xml | ||
| 246 | index 3d61a901..5c1a5f3f 100644 | ||
| 247 | --- a/examples/encrypt1-tmpl.xml | ||
| 248 | +++ b/examples/encrypt1-tmpl.xml | ||
| 249 | @@ -1,12 +1,12 @@ | ||
| 250 | <?xml version="1.0"?> | ||
| 251 | -<!-- | ||
| 252 | -XML Security Library example: Simple encryption template file for encrypt1 example. | ||
| 253 | +<!-- | ||
| 254 | +XML Security Library example: Simple encryption template file for encrypt1 example. | ||
| 255 | --> | ||
| 256 | <EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#"> | ||
| 257 | <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> | ||
| 258 | <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> | ||
| 259 | - <KeyName/> | ||
| 260 | - </KeyInfo> | ||
| 261 | + <KeyName>deskey.bin</KeyName> | ||
| 262 | + </KeyInfo> | ||
| 263 | <CipherData> | ||
| 264 | <CipherValue></CipherValue> | ||
| 265 | </CipherData> | ||
| 266 | diff --git a/examples/encrypt1.c b/examples/encrypt1.c | ||
| 267 | index ee3eaa8b..dc52ccf5 100644 | ||
| 268 | --- a/examples/encrypt1.c | ||
| 269 | +++ b/examples/encrypt1.c | ||
| 270 | @@ -55,8 +55,6 @@ main(int argc, char **argv) { | ||
| 271 | /* Init libxml and libxslt libraries */ | ||
| 272 | xmlInitParser(); | ||
| 273 | LIBXML_TEST_VERSION | ||
| 274 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 275 | - xmlSubstituteEntitiesDefault(1); | ||
| 276 | |||
| 277 | /* Init libxslt */ | ||
| 278 | #ifndef XMLSEC_NO_XSLT | ||
| 279 | @@ -156,7 +154,7 @@ encrypt_file(const char* tmpl_file, const char* key_file, | ||
| 280 | assert(data); | ||
| 281 | |||
| 282 | /* load template */ | ||
| 283 | - doc = xmlReadFile(tmpl_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 284 | + doc = xmlReadFile(tmpl_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 285 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 286 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file); | ||
| 287 | goto done; | ||
| 288 | diff --git a/examples/encrypt2.c b/examples/encrypt2.c | ||
| 289 | index 14b57af9..989afec3 100644 | ||
| 290 | --- a/examples/encrypt2.c | ||
| 291 | +++ b/examples/encrypt2.c | ||
| 292 | @@ -56,8 +56,6 @@ main(int argc, char **argv) { | ||
| 293 | /* Init libxml and libxslt libraries */ | ||
| 294 | xmlInitParser(); | ||
| 295 | LIBXML_TEST_VERSION | ||
| 296 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 297 | - xmlSubstituteEntitiesDefault(1); | ||
| 298 | |||
| 299 | /* Init libxslt */ | ||
| 300 | #ifndef XMLSEC_NO_XSLT | ||
| 301 | @@ -154,7 +152,7 @@ encrypt_file(const char* xml_file, const char* key_file) { | ||
| 302 | assert(key_file); | ||
| 303 | |||
| 304 | /* load template */ | ||
| 305 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 306 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 307 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 308 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 309 | goto done; | ||
| 310 | diff --git a/examples/encrypt3-res.xml b/examples/encrypt3-res.xml | ||
| 311 | index 2fca87e7..129771a6 100644 | ||
| 312 | --- a/examples/encrypt3-res.xml | ||
| 313 | +++ b/examples/encrypt3-res.xml | ||
| 314 | @@ -11,13 +11,13 @@ XML Security Library example: Original XML doc file before encryption (encrypt3 | ||
| 315 | <KeyName>rsakey.pem</KeyName> | ||
| 316 | </KeyInfo> | ||
| 317 | <CipherData> | ||
| 318 | -<CipherValue>QYYKljhcX20QyP20hYmq8CSES875oIdbrsjMOxnb0VnYDn01Jk00OIPpb9gdIdZg | ||
| 319 | -MLOtSy26mWrQ+XqfPGuyaA==</CipherValue> | ||
| 320 | +<CipherValue>pFfhaCpQfHTOJ+mRN919Ia3JimY2AS/8u9pimLEWGGjh3egy3pE2st4+YoVkpS4G | ||
| 321 | +XyUU4Ps+KRzsdJcKI4moXQ==</CipherValue> | ||
| 322 | </CipherData> | ||
| 323 | </EncryptedKey> | ||
| 324 | </KeyInfo> | ||
| 325 | <CipherData> | ||
| 326 | -<CipherValue>+UiDv73SE8K8KwXuOmHLHK7N2hNWDakTAEu6NprbCdULC1w/LXT9FLtNRJetmwwO | ||
| 327 | -XpBqTY56AAMeMgpxPWN3SPO0ETeQw7pR+bp0IjUvcGlFSXz6yE1qgQ==</CipherValue> | ||
| 328 | +<CipherValue>PMuoILFXjCmMg2pCzrmJYZcySLsTzgGYRX2ymYV9tLVrNSPhWV2mwMHWMchSWH9b | ||
| 329 | +8pRgdaJ3msWmN3EqqElV1Y5wEDQjB5nMz7Tsz3+QmrAxGfxj7bCPyw==</CipherValue> | ||
| 330 | </CipherData> | ||
| 331 | </EncryptedData> | ||
| 332 | diff --git a/examples/encrypt3.c b/examples/encrypt3.c | ||
| 333 | index e3f23104..71a6a559 100644 | ||
| 334 | --- a/examples/encrypt3.c | ||
| 335 | +++ b/examples/encrypt3.c | ||
| 336 | @@ -7,7 +7,8 @@ | ||
| 337 | * Usage: | ||
| 338 | * ./encrypt3 <xml-doc> <rsa-pem-key-file> | ||
| 339 | * | ||
| 340 | - * Example: | ||
| 341 | + * Example (note: we are using the private key here instead of the public | ||
| 342 | + * key to make decrypt3 example work): | ||
| 343 | * ./encrypt3 encrypt3-doc.xml rsakey.pem > encrypt3-res.xml | ||
| 344 | * | ||
| 345 | * The result could be decrypted with decrypt3 example: | ||
| 346 | @@ -58,8 +59,6 @@ main(int argc, char **argv) { | ||
| 347 | /* Init libxml and libxslt libraries */ | ||
| 348 | xmlInitParser(); | ||
| 349 | LIBXML_TEST_VERSION | ||
| 350 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 351 | - xmlSubstituteEntitiesDefault(1); | ||
| 352 | |||
| 353 | /* Init libxslt */ | ||
| 354 | #ifndef XMLSEC_NO_XSLT | ||
| 355 | @@ -233,7 +232,7 @@ encrypt_file(xmlSecKeysMngrPtr mngr, const char* xml_file, const char* key_name) | ||
| 356 | assert(key_name); | ||
| 357 | |||
| 358 | /* load template */ | ||
| 359 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 360 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 361 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 362 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 363 | goto done; | ||
| 364 | diff --git a/examples/sign1-tmpl.xml b/examples/sign1-tmpl.xml | ||
| 365 | index ac71a949..34b96f6f 100644 | ||
| 366 | --- a/examples/sign1-tmpl.xml | ||
| 367 | +++ b/examples/sign1-tmpl.xml | ||
| 368 | @@ -1,6 +1,6 @@ | ||
| 369 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 370 | -<!-- | ||
| 371 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 372 | +<!-- | ||
| 373 | +XML Security Library example: Simple signature template file for sign1 example. | ||
| 374 | --> | ||
| 375 | <Envelope xmlns="urn:envelope"> | ||
| 376 | <Data> | ||
| 377 | @@ -20,7 +20,7 @@ XML Security Library example: Simple signature template file for sign1 example. | ||
| 378 | </SignedInfo> | ||
| 379 | <SignatureValue/> | ||
| 380 | <KeyInfo> | ||
| 381 | - <KeyName/> | ||
| 382 | + <KeyName>rsakey.pem</KeyName> | ||
| 383 | </KeyInfo> | ||
| 384 | </Signature> | ||
| 385 | </Envelope> | ||
| 386 | diff --git a/examples/sign1.c b/examples/sign1.c | ||
| 387 | index be107333..e86d3604 100644 | ||
| 388 | --- a/examples/sign1.c | ||
| 389 | +++ b/examples/sign1.c | ||
| 390 | @@ -54,8 +54,6 @@ main(int argc, char **argv) { | ||
| 391 | /* Init libxml and libxslt libraries */ | ||
| 392 | xmlInitParser(); | ||
| 393 | LIBXML_TEST_VERSION | ||
| 394 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 395 | - xmlSubstituteEntitiesDefault(1); | ||
| 396 | |||
| 397 | /* Init libxslt */ | ||
| 398 | #ifndef XMLSEC_NO_XSLT | ||
| 399 | @@ -150,7 +148,7 @@ sign_file(const char* tmpl_file, const char* key_file) { | ||
| 400 | assert(key_file); | ||
| 401 | |||
| 402 | /* load template */ | ||
| 403 | - doc = xmlReadFile(tmpl_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 404 | + doc = xmlReadFile(tmpl_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 405 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 406 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file); | ||
| 407 | goto done; | ||
| 408 | diff --git a/examples/sign2.c b/examples/sign2.c | ||
| 409 | index 1a6ee936..a5408a0a 100644 | ||
| 410 | --- a/examples/sign2.c | ||
| 411 | +++ b/examples/sign2.c | ||
| 412 | @@ -57,8 +57,6 @@ main(int argc, char **argv) { | ||
| 413 | /* Init libxml and libxslt libraries */ | ||
| 414 | xmlInitParser(); | ||
| 415 | LIBXML_TEST_VERSION | ||
| 416 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 417 | - xmlSubstituteEntitiesDefault(1); | ||
| 418 | |||
| 419 | /* Init libxslt */ | ||
| 420 | #ifndef XMLSEC_NO_XSLT | ||
| 421 | @@ -156,7 +154,7 @@ sign_file(const char* xml_file, const char* key_file) { | ||
| 422 | assert(key_file); | ||
| 423 | |||
| 424 | /* load doc file */ | ||
| 425 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 426 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 427 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 428 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 429 | goto done; | ||
| 430 | diff --git a/examples/sign3.c b/examples/sign3.c | ||
| 431 | index de372e42..c927d946 100644 | ||
| 432 | --- a/examples/sign3.c | ||
| 433 | +++ b/examples/sign3.c | ||
| 434 | @@ -61,8 +61,6 @@ main(int argc, char **argv) { | ||
| 435 | /* Init libxml and libxslt libraries */ | ||
| 436 | xmlInitParser(); | ||
| 437 | LIBXML_TEST_VERSION | ||
| 438 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 439 | - xmlSubstituteEntitiesDefault(1); | ||
| 440 | |||
| 441 | /* Init libxslt */ | ||
| 442 | #ifndef XMLSEC_NO_XSLT | ||
| 443 | @@ -164,7 +162,7 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) { | ||
| 444 | assert(cert_file); | ||
| 445 | |||
| 446 | /* load doc file */ | ||
| 447 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 448 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 449 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 450 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 451 | goto done; | ||
| 452 | diff --git a/examples/sign4.c b/examples/sign4.c | ||
| 453 | index bb5f03b3..012e4b63 100644 | ||
| 454 | --- a/examples/sign4.c | ||
| 455 | +++ b/examples/sign4.c | ||
| 456 | @@ -60,8 +60,6 @@ main(int argc, char **argv) { | ||
| 457 | /* Init libxml and libxslt libraries */ | ||
| 458 | xmlInitParser(); | ||
| 459 | LIBXML_TEST_VERSION | ||
| 460 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 461 | - xmlSubstituteEntitiesDefault(1); | ||
| 462 | |||
| 463 | /* Init libxslt */ | ||
| 464 | #ifndef XMLSEC_NO_XSLT | ||
| 465 | @@ -167,7 +165,7 @@ sign_file(const char* xml_file, const char* id_attr, const char* key_file, const | ||
| 466 | assert(cert_file); | ||
| 467 | |||
| 468 | /* load doc file */ | ||
| 469 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 470 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 471 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 472 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 473 | goto done; | ||
| 474 | diff --git a/examples/verify-saml.c b/examples/verify-saml.c | ||
| 475 | index fea78a7f..95abaf0e 100644 | ||
| 476 | --- a/examples/verify-saml.c | ||
| 477 | +++ b/examples/verify-saml.c | ||
| 478 | @@ -65,8 +65,6 @@ main(int argc, char **argv) { | ||
| 479 | /* Init libxml and libxslt libraries */ | ||
| 480 | xmlInitParser(); | ||
| 481 | LIBXML_TEST_VERSION | ||
| 482 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 483 | - xmlSubstituteEntitiesDefault(1); | ||
| 484 | |||
| 485 | /* Init libxslt */ | ||
| 486 | #ifndef XMLSEC_NO_XSLT | ||
| 487 | @@ -221,7 +219,7 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) { | ||
| 488 | assert(xml_file); | ||
| 489 | |||
| 490 | /* load file */ | ||
| 491 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 492 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 493 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 494 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 495 | goto done; | ||
| 496 | diff --git a/examples/verify1.c b/examples/verify1.c | ||
| 497 | index 00ad07e1..73c6063f 100644 | ||
| 498 | --- a/examples/verify1.c | ||
| 499 | +++ b/examples/verify1.c | ||
| 500 | @@ -53,8 +53,6 @@ main(int argc, char **argv) { | ||
| 501 | /* Init libxml and libxslt libraries */ | ||
| 502 | xmlInitParser(); | ||
| 503 | LIBXML_TEST_VERSION | ||
| 504 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 505 | - xmlSubstituteEntitiesDefault(1); | ||
| 506 | |||
| 507 | /* Init libxslt */ | ||
| 508 | #ifndef XMLSEC_NO_XSLT | ||
| 509 | @@ -149,7 +147,7 @@ verify_file(const char* xml_file, const char* key_file) { | ||
| 510 | assert(key_file); | ||
| 511 | |||
| 512 | /* load file */ | ||
| 513 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 514 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 515 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 516 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 517 | goto done; | ||
| 518 | diff --git a/examples/verify2.c b/examples/verify2.c | ||
| 519 | index 377dccc5..f421f89f 100644 | ||
| 520 | --- a/examples/verify2.c | ||
| 521 | +++ b/examples/verify2.c | ||
| 522 | @@ -56,8 +56,6 @@ main(int argc, char **argv) { | ||
| 523 | /* Init libxml and libxslt libraries */ | ||
| 524 | xmlInitParser(); | ||
| 525 | LIBXML_TEST_VERSION | ||
| 526 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 527 | - xmlSubstituteEntitiesDefault(1); | ||
| 528 | |||
| 529 | /* Init libxslt */ | ||
| 530 | #ifndef XMLSEC_NO_XSLT | ||
| 531 | @@ -232,7 +230,7 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) { | ||
| 532 | assert(xml_file); | ||
| 533 | |||
| 534 | /* load file */ | ||
| 535 | - doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET); | ||
| 536 | + doc = xmlReadFile(xml_file, NULL, XML_PARSE_PEDANTIC | XML_PARSE_NONET | XML_PARSE_NOENT); | ||
| 537 | if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ | ||
| 538 | fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file); | ||
| 539 | goto done; | ||
| 540 | diff --git a/examples/verify3.c b/examples/verify3.c | ||
| 541 | index 558e3290..04dd32b0 100644 | ||
| 542 | --- a/examples/verify3.c | ||
| 543 | +++ b/examples/verify3.c | ||
| 544 | @@ -57,8 +57,6 @@ main(int argc, char **argv) { | ||
| 545 | /* Init libxml and libxslt libraries */ | ||
| 546 | xmlInitParser(); | ||
| 547 | LIBXML_TEST_VERSION | ||
| 548 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 549 | - xmlSubstituteEntitiesDefault(1); | ||
| 550 | |||
| 551 | /* Init libxslt */ | ||
| 552 | #ifndef XMLSEC_NO_XSLT | ||
| 553 | diff --git a/examples/verify4.c b/examples/verify4.c | ||
| 554 | index 705d8a5f..23a96918 100644 | ||
| 555 | --- a/examples/verify4.c | ||
| 556 | +++ b/examples/verify4.c | ||
| 557 | @@ -57,8 +57,6 @@ main(int argc, char **argv) { | ||
| 558 | /* Init libxml and libxslt libraries */ | ||
| 559 | xmlInitParser(); | ||
| 560 | LIBXML_TEST_VERSION | ||
| 561 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 562 | - xmlSubstituteEntitiesDefault(1); | ||
| 563 | |||
| 564 | /* Init libxslt */ | ||
| 565 | #ifndef XMLSEC_NO_XSLT | ||
| 566 | diff --git a/examples/xmldsigverify.c b/examples/xmldsigverify.c | ||
| 567 | deleted file mode 100644 | ||
| 568 | index c6611f43..00000000 | ||
| 569 | --- a/examples/xmldsigverify.c | ||
| 570 | +++ /dev/null | ||
| 571 | @@ -1,379 +0,0 @@ | ||
| 572 | -/** | ||
| 573 | - * XML Security Library example: CGI verification script. | ||
| 574 | - * | ||
| 575 | - * This is free software; see Copyright file in the source | ||
| 576 | - * distribution for preciese wording. | ||
| 577 | - * | ||
| 578 | - * Copyright (C) 2002-2024 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved. | ||
| 579 | - */ | ||
| 580 | -#include <stdlib.h> | ||
| 581 | -#include <string.h> | ||
| 582 | -#include <assert.h> | ||
| 583 | -#include <dirent.h> | ||
| 584 | - | ||
| 585 | -#include <libxml/tree.h> | ||
| 586 | -#include <libxml/xmlmemory.h> | ||
| 587 | -#include <libxml/parser.h> | ||
| 588 | - | ||
| 589 | -#ifndef XMLSEC_NO_XSLT | ||
| 590 | -#include <libxslt/xslt.h> | ||
| 591 | -#include <libxslt/security.h> | ||
| 592 | -#endif /* XMLSEC_NO_XSLT */ | ||
| 593 | - | ||
| 594 | -#include <xmlsec/xmlsec.h> | ||
| 595 | -#include <xmlsec/xmltree.h> | ||
| 596 | -#include <xmlsec/xmldsig.h> | ||
| 597 | -#include <xmlsec/crypto.h> | ||
| 598 | - | ||
| 599 | -#include <xmlsec/parser.h> | ||
| 600 | -/* #define XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER "/etc/httpd/conf/ssl.crt" */ | ||
| 601 | -#define XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER "/var/www/cgi-bin/keys-certs.def" | ||
| 602 | -#define XMLDSIGVERIFY_KEY_AND_CERTS_FOLDER "/var/www/cgi-bin/keys-certs" | ||
| 603 | - | ||
| 604 | - | ||
| 605 | -int load_keys(xmlSecKeysMngrPtr mngr, const char* path, int report_loaded_keys); | ||
| 606 | -int load_trusted_certs(xmlSecKeysMngrPtr mngr, const char* path, int report_loaded_certs); | ||
| 607 | -int verify_request(xmlSecKeysMngrPtr mngr); | ||
| 608 | -int url_decode(char *buf, size_t size); | ||
| 609 | - | ||
| 610 | -int | ||
| 611 | -main() { | ||
| 612 | - xmlSecKeysMngrPtr mngr; | ||
| 613 | -#ifndef XMLSEC_NO_XSLT | ||
| 614 | - xsltSecurityPrefsPtr xsltSecPrefs = NULL; | ||
| 615 | -#endif /* XMLSEC_NO_XSLT */ | ||
| 616 | - | ||
| 617 | - /* start response */ | ||
| 618 | - fprintf(stdout, "Content-type: text/plain\n"); | ||
| 619 | - fprintf(stdout, "\n"); | ||
| 620 | - | ||
| 621 | - /* Init libxml and libxslt libraries */ | ||
| 622 | - xmlInitParser(); | ||
| 623 | - LIBXML_TEST_VERSION | ||
| 624 | - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; | ||
| 625 | - xmlSubstituteEntitiesDefault(1); | ||
| 626 | - | ||
| 627 | - /* make sure that we print out everything to stdout */ | ||
| 628 | - xmlGenericErrorContext = stdout; | ||
| 629 | - | ||
| 630 | - /* Init libxslt */ | ||
| 631 | -#ifndef XMLSEC_NO_XSLT | ||
| 632 | - /* disable everything */ | ||
| 633 | - xsltSecPrefs = xsltNewSecurityPrefs(); | ||
| 634 | - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid); | ||
| 635 | - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid); | ||
| 636 | - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid); | ||
| 637 | - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid); | ||
| 638 | - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid); | ||
| 639 | - xsltSetDefaultSecurityPrefs(xsltSecPrefs); | ||
| 640 | -#endif /* XMLSEC_NO_XSLT */ | ||
| 641 | - | ||
| 642 | - /* Init xmlsec library */ | ||
| 643 | - if(xmlSecInit() < 0) { | ||
| 644 | - fprintf(stdout, "Error: xmlsec initialization failed.\n"); | ||
| 645 | - return(-1); | ||
| 646 | - } | ||
| 647 | - | ||
| 648 | - /* Check loaded library version */ | ||
| 649 | - if(xmlSecCheckVersion() != 1) { | ||
| 650 | - fprintf(stdout, "Error: loaded xmlsec library version is not compatible.\n"); | ||
| 651 | - return(-1); | ||
| 652 | - } | ||
| 653 | - | ||
| 654 | - /* Load default crypto engine if we are supporting dynamic | ||
| 655 | - * loading for xmlsec-crypto libraries. Use the crypto library | ||
| 656 | - * name ("openssl", "nss", etc.) to load corresponding | ||
| 657 | - * xmlsec-crypto library. | ||
| 658 | - */ | ||
| 659 | -#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING | ||
| 660 | - if(xmlSecCryptoDLLoadLibrary(NULL) < 0) { | ||
| 661 | - fprintf(stdout, "Error: unable to load default xmlsec-crypto library. Make sure\n" | ||
| 662 | - "that you have it installed and check shared libraries path\n" | ||
| 663 | - "(LD_LIBRARY_PATH and/or LTDL_LIBRARY_PATH) environment variables.\n"); | ||
| 664 | - return(-1); | ||
| 665 | - } | ||
| 666 | -#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */ | ||
| 667 | - | ||
| 668 | - /* Init crypto library */ | ||
| 669 | - if(xmlSecCryptoAppInit(XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER) < 0) { | ||
| 670 | - fprintf(stdout, "Error: crypto initialization failed.\n"); | ||
| 671 | - return(-1); | ||
| 672 | - } | ||
| 673 | - | ||
| 674 | - /* Init xmlsec-crypto library */ | ||
| 675 | - if(xmlSecCryptoInit() < 0) { | ||
| 676 | - fprintf(stdout, "Error: xmlsec-crypto initialization failed.\n"); | ||
| 677 | - return(-1); | ||
| 678 | - } | ||
| 679 | - | ||
| 680 | - /* create keys manager */ | ||
| 681 | - mngr = xmlSecKeysMngrCreate(); | ||
| 682 | - if(mngr == NULL) { | ||
| 683 | - fprintf(stdout, "Error: failed to create keys manager.\n"); | ||
| 684 | - return(-1); | ||
| 685 | - } | ||
| 686 | - if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) { | ||
| 687 | - fprintf(stdout, "Error: failed to initialize keys manager.\n"); | ||
| 688 | - return(-1); | ||
| 689 | - } | ||
| 690 | - | ||
| 691 | - if(load_keys(mngr, XMLDSIGVERIFY_KEY_AND_CERTS_FOLDER, 0) < 0) { | ||
| 692 | - xmlSecKeysMngrDestroy(mngr); | ||
| 693 | - return(-1); | ||
| 694 | - } | ||
| 695 | - | ||
| 696 | - if(load_trusted_certs(mngr, XMLDSIGVERIFY_KEY_AND_CERTS_FOLDER, 0) < 0) { | ||
| 697 | - xmlSecKeysMngrDestroy(mngr); | ||
| 698 | - return(-1); | ||
| 699 | - } | ||
| 700 | - | ||
| 701 | - if(verify_request(mngr) < 0) { | ||
| 702 | - xmlSecKeysMngrDestroy(mngr); | ||
| 703 | - return(-1); | ||
| 704 | - } | ||
| 705 | - | ||
| 706 | - /* Destroy keys manager */ | ||
| 707 | - xmlSecKeysMngrDestroy(mngr); | ||
| 708 | - | ||
| 709 | - /* Shutdown xmlsec-crypto library */ | ||
| 710 | - xmlSecCryptoShutdown(); | ||
| 711 | - | ||
| 712 | - /* Shutdown crypto library */ | ||
| 713 | - xmlSecCryptoAppShutdown(); | ||
| 714 | - | ||
| 715 | - /* Shutdown xmlsec library */ | ||
| 716 | - xmlSecShutdown(); | ||
| 717 | - | ||
| 718 | - /* Shutdown libxslt/libxml */ | ||
| 719 | -#ifndef XMLSEC_NO_XSLT | ||
| 720 | - xsltFreeSecurityPrefs(xsltSecPrefs); | ||
| 721 | - xsltCleanupGlobals(); | ||
| 722 | -#endif /* XMLSEC_NO_XSLT */ | ||
| 723 | - | ||
| 724 | - xmlCleanupParser(); | ||
| 725 | - | ||
| 726 | - return(0); | ||
| 727 | -} | ||
| 728 | - | ||
| 729 | -/** | ||
| 730 | - * load_trusted_certs: | ||
| 731 | - * @mngr: the keys manager. | ||
| 732 | - * @path: the path to a folder that contains trusted certificates. | ||
| 733 | - * | ||
| 734 | - * Loads trusted certificates from @path. | ||
| 735 | - * | ||
| 736 | - * Returns 0 on success or a negative value if an error occurs. | ||
| 737 | - */ | ||
| 738 | -int load_trusted_certs(xmlSecKeysMngrPtr mngr, const char* path, int report_loaded_certs) { | ||
| 739 | - DIR* dir; | ||
| 740 | - struct dirent* entry; | ||
| 741 | - char filename[2048]; | ||
| 742 | - int len; | ||
| 743 | - | ||
| 744 | - assert(mngr); | ||
| 745 | - assert(path); | ||
| 746 | - | ||
| 747 | - dir = opendir(path); | ||
| 748 | - if(dir == NULL) { | ||
| 749 | - fprintf(stdout, "Error: failed to open folder \"%s\".\n", path); | ||
| 750 | - return(-1); | ||
| 751 | - } | ||
| 752 | - while((entry = readdir(dir)) != NULL) { | ||
| 753 | - assert(entry->d_name); | ||
| 754 | - len = strlen(entry->d_name); | ||
| 755 | - if((len > 4) && (strcmp(entry->d_name + len - 4, ".pem") == 0)) { | ||
| 756 | - snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name); | ||
| 757 | - if(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) { | ||
| 758 | - fprintf(stdout,"Error: failed to load pem certificate from \"%s\"\n", filename); | ||
| 759 | - closedir(dir); | ||
| 760 | - return(-1); | ||
| 761 | - } | ||
| 762 | - if(report_loaded_certs) { | ||
| 763 | - fprintf(stdout, "Loaded trusted certificate from \"%s\"...\n", filename); | ||
| 764 | - } | ||
| 765 | - } else if((len > 4) && (strcmp(entry->d_name + len - 4, ".der") == 0)) { | ||
| 766 | - snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name); | ||
| 767 | - if(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, xmlSecKeyDataFormatDer, xmlSecKeyDataTypeTrusted) < 0) { | ||
| 768 | - fprintf(stdout,"Error: failed to load der certificate from \"%s\"\n", filename); | ||
| 769 | - closedir(dir); | ||
| 770 | - return(-1); | ||
| 771 | - } | ||
| 772 | - if(report_loaded_certs) { | ||
| 773 | - fprintf(stdout, "Loaded trusted certificate from \"%s\"...\n", filename); | ||
| 774 | - } | ||
| 775 | - } | ||
| 776 | - } | ||
| 777 | - closedir(dir); | ||
| 778 | - return(0); | ||
| 779 | -} | ||
| 780 | - | ||
| 781 | -int load_keys(xmlSecKeysMngrPtr mngr, const char* path, int report_loaded_keys) { | ||
| 782 | - char filename[256]; | ||
| 783 | - | ||
| 784 | - assert(mngr); | ||
| 785 | - | ||
| 786 | - snprintf(filename, sizeof(filename), "%s/keys.xml", path); | ||
| 787 | - if(xmlSecCryptoAppDefaultKeysMngrLoad(mngr, filename) < 0) { | ||
| 788 | - fprintf(stdout,"Error: failed to load keys from \"%s\"\n", filename); | ||
| 789 | - return(-1); | ||
| 790 | - } | ||
| 791 | - | ||
| 792 | - if(report_loaded_keys) { | ||
| 793 | - fprintf(stdout, "Loaded keys from \"%s\"...\n", filename); | ||
| 794 | - } | ||
| 795 | - return(0); | ||
| 796 | -} | ||
| 797 | - | ||
| 798 | - | ||
| 799 | -/** | ||
| 800 | - * verify_request: | ||
| 801 | - * @mng: the keys manager | ||
| 802 | - * | ||
| 803 | - * Verifies XML signature in the request (stdin). | ||
| 804 | - * | ||
| 805 | - * Returns 0 on success or a negative value if an error occurs. | ||
| 806 | - */ | ||
| 807 | -int | ||
| 808 | -verify_request(xmlSecKeysMngrPtr mngr) { | ||
| 809 | - xmlBufferPtr buffer = NULL; | ||
| 810 | - xmlSecByte buf[256]; | ||
| 811 | - xmlDocPtr doc = NULL; | ||
| 812 | - xmlNodePtr node = NULL; | ||
| 813 | - xmlSecDSigCtxPtr dsigCtx = NULL; | ||
| 814 | - int ret; | ||
| 815 | - int res = -1; | ||
| 816 | - | ||
| 817 | - assert(mngr); | ||
| 818 | - | ||
| 819 | - /* load request in the buffer */ | ||
| 820 | - buffer = xmlBufferCreate(); | ||
| 821 | - if(buffer == NULL) { | ||
| 822 | - fprintf(stdout,"Error: failed to create buffer\n"); | ||
| 823 | - goto done; | ||
| 824 | - } | ||
| 825 | - | ||
| 826 | - while(!feof(stdin)) { | ||
| 827 | - ret = fread(buf, 1, sizeof(buf), stdin); | ||
| 828 | - if(ret < 0) { | ||
| 829 | - fprintf(stdout,"Error: read failed\n"); | ||
| 830 | - goto done; | ||
| 831 | - } | ||
| 832 | - xmlBufferAdd(buffer, buf, (xmlSecSize)ret); | ||
| 833 | - } | ||
| 834 | - | ||
| 835 | - /* is the document submitted from the form? */ | ||
| 836 | - if(strncmp((char*)xmlBufferContent(buffer), "_xmldoc=", 8) == 0) { | ||
| 837 | - xmlBufferShrink(buffer, 8); | ||
| 838 | - buffer->use = url_decode((char*)xmlBufferContent(buffer), xmlBufferLength(buffer)); | ||
| 839 | - } | ||
| 840 | - | ||
| 841 | - /** | ||
| 842 | - * Load doc | ||
| 843 | - */ | ||
| 844 | - xmlSecParserSetDefaultOptions(XML_PARSE_NOENT | XML_PARSE_NOCDATA | | ||
| 845 | - XML_PARSE_PEDANTIC | XML_PARSE_NOCDATA); | ||
| 846 | - doc = xmlReadMemory((const char*)xmlBufferContent(buffer), xmlBufferLength(buffer), | ||
| 847 | - NULL, NULL, xmlSecParserGetDefaultOptions()); | ||
| 848 | - if (doc == NULL) { | ||
| 849 | - fprintf(stdout, "Error: unable to parse xml document (syntax error)\n"); | ||
| 850 | - goto done; | ||
| 851 | - } | ||
| 852 | - | ||
| 853 | - /* | ||
| 854 | - * Check the document is of the right kind | ||
| 855 | - */ | ||
| 856 | - if(xmlDocGetRootElement(doc) == NULL) { | ||
| 857 | - fprintf(stdout,"Error: empty document\n"); | ||
| 858 | - goto done; | ||
| 859 | - } | ||
| 860 | - | ||
| 861 | - /* find start node */ | ||
| 862 | - node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs); | ||
| 863 | - if(node == NULL) { | ||
| 864 | - fprintf(stdout, "Error: start <dsig:Signature/> node not found\n"); | ||
| 865 | - goto done; | ||
| 866 | - } | ||
| 867 | - | ||
| 868 | - /* create signature context */ | ||
| 869 | - dsigCtx = xmlSecDSigCtxCreate(mngr); | ||
| 870 | - if(dsigCtx == NULL) { | ||
| 871 | - fprintf(stdout,"Error: failed to create signature context\n"); | ||
| 872 | - goto done; | ||
| 873 | - } | ||
| 874 | - | ||
| 875 | - /* we would like to store and print out everything */ | ||
| 876 | - /* actually we would not because it opens a security hole | ||
| 877 | - dsigCtx->flags = XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES | | ||
| 878 | - XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES | | ||
| 879 | - XMLSEC_DSIG_FLAGS_STORE_SIGNATURE; | ||
| 880 | - */ | ||
| 881 | - | ||
| 882 | - /* Verify signature */ | ||
| 883 | - if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) { | ||
| 884 | - fprintf(stdout,"Error: signature verification failed\n"); | ||
| 885 | - goto done; | ||
| 886 | - } | ||
| 887 | - | ||
| 888 | - /* print verification result to stdout */ | ||
| 889 | - if(dsigCtx->status == xmlSecDSigStatusSucceeded) { | ||
| 890 | - fprintf(stdout, "RESULT: Signature is OK\n"); | ||
| 891 | - } else { | ||
| 892 | - fprintf(stdout, "RESULT: Signature is INVALID\n"); | ||
| 893 | - } | ||
| 894 | - fprintf(stdout, "---------------------------------------------------\n"); | ||
| 895 | - xmlSecDSigCtxDebugDump(dsigCtx, stdout); | ||
| 896 | - | ||
| 897 | - /* success */ | ||
| 898 | - res = 0; | ||
| 899 | - | ||
| 900 | -done: | ||
| 901 | - /* cleanup */ | ||
| 902 | - if(dsigCtx != NULL) { | ||
| 903 | - xmlSecDSigCtxDestroy(dsigCtx); | ||
| 904 | - } | ||
| 905 | - | ||
| 906 | - if(doc != NULL) { | ||
| 907 | - xmlFreeDoc(doc); | ||
| 908 | - } | ||
| 909 | - | ||
| 910 | - if(buffer != NULL) { | ||
| 911 | - xmlBufferFree(buffer); | ||
| 912 | - } | ||
| 913 | - return(res); | ||
| 914 | -} | ||
| 915 | - | ||
| 916 | -/* not the best way to do it */ | ||
| 917 | -#define toHex(c) ( ( ('0' <= (c)) && ((c) <= '9') ) ? (c) - '0' : \ | ||
| 918 | - ( ( ('A' <= (c)) && ((c) <= 'F') ) ? (c) - 'A' + 10 : 0 ) ) | ||
| 919 | - | ||
| 920 | -/** | ||
| 921 | - * url_decode: | ||
| 922 | - * @buf: the input buffer. | ||
| 923 | - * @size: the input buffer size. | ||
| 924 | - * | ||
| 925 | - * Does url decoding in-place. | ||
| 926 | - * | ||
| 927 | - * Returns length of the decoded result on success or | ||
| 928 | - * a negative value if an error occurs. | ||
| 929 | - */ | ||
| 930 | -int url_decode(char *buf, size_t size) { | ||
| 931 | - size_t ii, jj; | ||
| 932 | - char ch; | ||
| 933 | - | ||
| 934 | - assert(buf); | ||
| 935 | - | ||
| 936 | - for(ii = jj = 0; ii < size; ++ii, ++jj) { | ||
| 937 | - ch = buf[ii]; | ||
| 938 | - if((ch == '%') && ((ii + 2) < size)) { | ||
| 939 | - buf[jj] = (char)(toHex(buf[ii + 1]) * 16 + toHex(buf[ii + 2])); | ||
| 940 | - ii += 2; | ||
| 941 | - } else if(ch == '+') { | ||
| 942 | - buf[jj] = ' '; | ||
| 943 | - } else if(ii != jj){ | ||
| 944 | - buf[jj] = buf[ii]; | ||
| 945 | - } | ||
| 946 | - } | ||
| 947 | - return((int)jj); | ||
| 948 | -} | ||
| 949 | - | ||
| 950 | - | ||
| 951 | diff --git a/tests/aleksey-xmldsig-01/enveloped-gost2001.xml b/tests/aleksey-xmldsig-01/enveloped-gost2001.xml | ||
| 952 | index a00b1a91..d2535e92 100644 | ||
| 953 | --- a/tests/aleksey-xmldsig-01/enveloped-gost2001.xml | ||
| 954 | +++ b/tests/aleksey-xmldsig-01/enveloped-gost2001.xml | ||
| 955 | @@ -1,7 +1,4 @@ | ||
| 956 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 957 | -<!-- | ||
| 958 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 959 | ---> | ||
| 960 | <Envelope xmlns="urn:envelope"> | ||
| 961 | <Data> | ||
| 962 | Hello, World! | ||
| 963 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.tmpl | ||
| 964 | index b1aef672..90c53215 100644 | ||
| 965 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.tmpl | ||
| 966 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.tmpl | ||
| 967 | @@ -1,7 +1,4 @@ | ||
| 968 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 969 | -<!-- | ||
| 970 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 971 | ---> | ||
| 972 | <Envelope xmlns="urn:envelope"> | ||
| 973 | <Data> | ||
| 974 | Hello, World! | ||
| 975 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.xml b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.xml | ||
| 976 | index 51813562..d0b7272f 100644 | ||
| 977 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.xml | ||
| 978 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha1.xml | ||
| 979 | @@ -1,7 +1,4 @@ | ||
| 980 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 981 | -<!-- | ||
| 982 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 983 | ---> | ||
| 984 | <Envelope xmlns="urn:envelope"> | ||
| 985 | <Data> | ||
| 986 | Hello, World! | ||
| 987 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.tmpl | ||
| 988 | index fe5e8e5d..6737c0e8 100644 | ||
| 989 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.tmpl | ||
| 990 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.tmpl | ||
| 991 | @@ -1,7 +1,4 @@ | ||
| 992 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 993 | -<!-- | ||
| 994 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 995 | ---> | ||
| 996 | <Envelope xmlns="urn:envelope"> | ||
| 997 | <Data> | ||
| 998 | Hello, World! | ||
| 999 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.xml b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.xml | ||
| 1000 | index 865770bf..06a76abd 100644 | ||
| 1001 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.xml | ||
| 1002 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha224.xml | ||
| 1003 | @@ -1,7 +1,4 @@ | ||
| 1004 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1005 | -<!-- | ||
| 1006 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1007 | ---> | ||
| 1008 | <Envelope xmlns="urn:envelope"> | ||
| 1009 | <Data> | ||
| 1010 | Hello, World! | ||
| 1011 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.tmpl | ||
| 1012 | index 3ccee872..86755bc8 100644 | ||
| 1013 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.tmpl | ||
| 1014 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.tmpl | ||
| 1015 | @@ -1,7 +1,4 @@ | ||
| 1016 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1017 | -<!-- | ||
| 1018 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1019 | ---> | ||
| 1020 | <Envelope xmlns="urn:envelope"> | ||
| 1021 | <Data> | ||
| 1022 | Hello, World! | ||
| 1023 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.xml b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.xml | ||
| 1024 | index 33c16f5d..283ebf57 100644 | ||
| 1025 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.xml | ||
| 1026 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha256.xml | ||
| 1027 | @@ -1,7 +1,4 @@ | ||
| 1028 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1029 | -<!-- | ||
| 1030 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1031 | ---> | ||
| 1032 | <Envelope xmlns="urn:envelope"> | ||
| 1033 | <Data> | ||
| 1034 | Hello, World! | ||
| 1035 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.tmpl | ||
| 1036 | index 2342efb5..f0513280 100644 | ||
| 1037 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.tmpl | ||
| 1038 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.tmpl | ||
| 1039 | @@ -1,7 +1,4 @@ | ||
| 1040 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1041 | -<!-- | ||
| 1042 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1043 | ---> | ||
| 1044 | <Envelope xmlns="urn:envelope"> | ||
| 1045 | <Data> | ||
| 1046 | Hello, World! | ||
| 1047 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.xml b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.xml | ||
| 1048 | index ca8581ce..384fcdaa 100644 | ||
| 1049 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.xml | ||
| 1050 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha384.xml | ||
| 1051 | @@ -1,7 +1,4 @@ | ||
| 1052 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1053 | -<!-- | ||
| 1054 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1055 | ---> | ||
| 1056 | <Envelope xmlns="urn:envelope"> | ||
| 1057 | <Data> | ||
| 1058 | Hello, World! | ||
| 1059 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.tmpl | ||
| 1060 | index 4c4d5e2c..05572e63 100644 | ||
| 1061 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.tmpl | ||
| 1062 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.tmpl | ||
| 1063 | @@ -1,7 +1,4 @@ | ||
| 1064 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1065 | -<!-- | ||
| 1066 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1067 | ---> | ||
| 1068 | <Envelope xmlns="urn:envelope"> | ||
| 1069 | <Data> | ||
| 1070 | Hello, World! | ||
| 1071 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.xml b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.xml | ||
| 1072 | index 2ff30400..c781cc0f 100644 | ||
| 1073 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.xml | ||
| 1074 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-digest-sha512.xml | ||
| 1075 | @@ -1,7 +1,4 @@ | ||
| 1076 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1077 | -<!-- | ||
| 1078 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1079 | ---> | ||
| 1080 | <Envelope xmlns="urn:envelope"> | ||
| 1081 | <Data> | ||
| 1082 | Hello, World! | ||
| 1083 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.tmpl | ||
| 1084 | index 48160c0b..bc7f712d 100644 | ||
| 1085 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.tmpl | ||
| 1086 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.tmpl | ||
| 1087 | @@ -1,7 +1,4 @@ | ||
| 1088 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1089 | -<!-- | ||
| 1090 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1091 | ---> | ||
| 1092 | <Envelope xmlns="urn:envelope"> | ||
| 1093 | <Data> | ||
| 1094 | Hello, World! | ||
| 1095 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.xml b/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.xml | ||
| 1096 | index d7ff383f..5adbecac 100644 | ||
| 1097 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.xml | ||
| 1098 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-issuerserial.xml | ||
| 1099 | @@ -1,7 +1,4 @@ | ||
| 1100 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1101 | -<!-- | ||
| 1102 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1103 | ---> | ||
| 1104 | <Envelope xmlns="urn:envelope"> | ||
| 1105 | <Data> | ||
| 1106 | Hello, World! | ||
| 1107 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.tmpl | ||
| 1108 | index 915dd55c..9e1cd393 100644 | ||
| 1109 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.tmpl | ||
| 1110 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.tmpl | ||
| 1111 | @@ -1,7 +1,4 @@ | ||
| 1112 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1113 | -<!-- | ||
| 1114 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1115 | ---> | ||
| 1116 | <Envelope xmlns="urn:envelope"> | ||
| 1117 | <Data> | ||
| 1118 | Hello, World! | ||
| 1119 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.xml b/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.xml | ||
| 1120 | index 2a517e0e..3dcba72e 100644 | ||
| 1121 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.xml | ||
| 1122 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-missing-cert.xml | ||
| 1123 | @@ -1,7 +1,4 @@ | ||
| 1124 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1125 | -<!-- | ||
| 1126 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1127 | ---> | ||
| 1128 | <Envelope xmlns="urn:envelope"> | ||
| 1129 | <Data> | ||
| 1130 | Hello, World! | ||
| 1131 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-same-subj-cert.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-same-subj-cert.tmpl | ||
| 1132 | index 915dd55c..9e1cd393 100644 | ||
| 1133 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-same-subj-cert.tmpl | ||
| 1134 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-same-subj-cert.tmpl | ||
| 1135 | @@ -1,7 +1,4 @@ | ||
| 1136 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1137 | -<!-- | ||
| 1138 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1139 | ---> | ||
| 1140 | <Envelope xmlns="urn:envelope"> | ||
| 1141 | <Data> | ||
| 1142 | Hello, World! | ||
| 1143 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-ski.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-ski.tmpl | ||
| 1144 | index 542680a9..adf7084c 100644 | ||
| 1145 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-ski.tmpl | ||
| 1146 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-ski.tmpl | ||
| 1147 | @@ -1,7 +1,4 @@ | ||
| 1148 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1149 | -<!-- | ||
| 1150 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1151 | ---> | ||
| 1152 | <Envelope xmlns="urn:envelope"> | ||
| 1153 | <Data> | ||
| 1154 | Hello, World! | ||
| 1155 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-ski.xml b/tests/aleksey-xmldsig-01/enveloped-x509-ski.xml | ||
| 1156 | index 68b2c554..89e77f0f 100644 | ||
| 1157 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-ski.xml | ||
| 1158 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-ski.xml | ||
| 1159 | @@ -1,7 +1,4 @@ | ||
| 1160 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1161 | -<!-- | ||
| 1162 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1163 | ---> | ||
| 1164 | <Envelope xmlns="urn:envelope"> | ||
| 1165 | <Data> | ||
| 1166 | Hello, World! | ||
| 1167 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.tmpl b/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.tmpl | ||
| 1168 | index ba982e63..868540cf 100644 | ||
| 1169 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.tmpl | ||
| 1170 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.tmpl | ||
| 1171 | @@ -1,7 +1,4 @@ | ||
| 1172 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1173 | -<!-- | ||
| 1174 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1175 | ---> | ||
| 1176 | <Envelope xmlns="urn:envelope"> | ||
| 1177 | <Data> | ||
| 1178 | Hello, World! | ||
| 1179 | diff --git a/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.xml b/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.xml | ||
| 1180 | index daa82e85..b4cfdb85 100644 | ||
| 1181 | --- a/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.xml | ||
| 1182 | +++ b/tests/aleksey-xmldsig-01/enveloped-x509-subjectname.xml | ||
| 1183 | @@ -1,7 +1,4 @@ | ||
| 1184 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 1185 | -<!-- | ||
| 1186 | -XML Security Library example: Simple signature template file for sign1 example. | ||
| 1187 | ---> | ||
| 1188 | <Envelope xmlns="urn:envelope"> | ||
| 1189 | <Data> | ||
| 1190 | Hello, World! | ||
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1/run-ptest b/meta-oe/recipes-support/xmlsec1/xmlsec1/run-ptest index afd8c69853..edb5f7a4b9 100755 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1/run-ptest +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1/run-ptest | |||
| @@ -8,78 +8,130 @@ check_return() { | |||
| 8 | fi | 8 | fi |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | echo "---------------------------------------------------" | 11 | echo "-----------------------------------------------------------------------------------------------" |
| 12 | echo "Signing a template file..." | 12 | echo "Signing a template file..." |
| 13 | ./sign1 sign1-tmpl.xml rsakey.pem > sign1-res.xml | 13 | ./sign1 sign1-tmpl.xml rsakey.pem > sign1-res.xml |
| 14 | ./verify1 sign1-res.xml rsapub.pem | ||
| 15 | check_return sign-tmpl | 14 | check_return sign-tmpl |
| 16 | 15 | ||
| 17 | echo "---------------------------------------------------" | 16 | echo "-----------------------------------------------------------------------------------------------" |
| 17 | echo "Signing a template file with xmlsec1..." | ||
| 18 | xmlsec1 sign --privkey:rsakey.pem rsakey.pem --output sign1-res-xmlsec1.xml sign1-tmpl.xml | ||
| 19 | check_return sign-tmpl-xmlsec1 | ||
| 20 | |||
| 21 | echo "-----------------------------------------------------------------------------------------------" | ||
| 18 | echo "Signing a dynamicaly created template..." | 22 | echo "Signing a dynamicaly created template..." |
| 19 | ./sign2 sign2-doc.xml rsakey.pem > sign2-res.xml | 23 | ./sign2 sign2-doc.xml rsakey.pem > sign2-res.xml |
| 20 | ./verify1 sign2-res.xml rsapub.pem | ||
| 21 | check_return sign-dynamic-templ | 24 | check_return sign-dynamic-templ |
| 22 | 25 | ||
| 23 | echo "---------------------------------------------------" | 26 | echo "-----------------------------------------------------------------------------------------------" |
| 24 | echo "Signing with X509 certificate..." | 27 | echo "Signing a file with a dynamicaly created template and an X509 certificate..." |
| 25 | ./sign3 sign3-doc.xml rsakey.pem rsacert.pem > sign3-res.xml | 28 | ./sign3 sign3-doc.xml rsakey.pem rsacert.pem > sign3-res.xml |
| 26 | ./verify3 sign3-res.xml ca2cert.pem cacert.pem | 29 | check_return sign-dynamic-templ-x509 |
| 27 | check_return sign-x509 | ||
| 28 | 30 | ||
| 29 | echo "---------------------------------------------------" | 31 | echo "-----------------------------------------------------------------------------------------------" |
| 32 | echo "Signing a node in a file with a dynamicaly created template and an X509 certificate..." | ||
| 33 | ./sign4 sign4-doc.xml "data" rsakey.pem rsacert.pem > sign4-res.xml | ||
| 34 | check_return sign-file-node-dynamic-templ-x509 | ||
| 35 | |||
| 36 | echo "-----------------------------------------------------------------------------------------------" | ||
| 30 | echo "Verifying a signature with a single key..." | 37 | echo "Verifying a signature with a single key..." |
| 31 | ./verify1 sign1-res.xml rsapub.pem | 38 | ./verify1 sign1-res.xml rsapub.pem |
| 39 | check_return verify-single-key-1 | ||
| 32 | ./verify1 sign2-res.xml rsapub.pem | 40 | ./verify1 sign2-res.xml rsapub.pem |
| 33 | check_return verify-single-key | 41 | check_return verify-single-key-2 |
| 34 | 42 | ||
| 35 | echo "---------------------------------------------------" | 43 | echo "-----------------------------------------------------------------------------------------------" |
| 36 | echo "Verifying a signature with keys manager..." | 44 | echo "Verifying a signature with keys manager..." |
| 37 | ./verify2 sign1-res.xml rsakey.pem | 45 | ./verify2 sign1-res.xml rsakey.pem |
| 46 | check_return verify-keys-1-manager | ||
| 38 | ./verify2 sign2-res.xml rsakey.pem | 47 | ./verify2 sign2-res.xml rsakey.pem |
| 39 | check_return verify-keys-manager | 48 | check_return verify-keys-2-manager |
| 49 | |||
| 50 | echo "-----------------------------------------------------------------------------------------------" | ||
| 51 | echo "Verifying a signature with xmlsec1..." | ||
| 52 | xmlsec1 verify --pubkey:rsakey.pem rsapub.pem sign1-res-xmlsec1.xml | ||
| 53 | check_return verify-keys-1-xmlsec1 | ||
| 54 | xmlsec1 verify --pubkey:rsakey.pem rsapub.pem sign2-res.xml | ||
| 55 | check_return verify-keys-2-xmlsec1 | ||
| 40 | 56 | ||
| 41 | echo "---------------------------------------------------" | 57 | echo "-----------------------------------------------------------------------------------------------" |
| 42 | echo "Verifying a signature with X509 certificates..." | 58 | echo "Verifying a signature with X509 certificates..." |
| 43 | ./verify3 sign3-res.xml ca2cert.pem cacert.pem | 59 | ./verify3 sign3-res.xml ca2cert.pem cacert.pem |
| 44 | check_return verify-x509 | 60 | check_return verify-x509 |
| 45 | 61 | ||
| 46 | echo "---------------------------------------------------" | 62 | echo "-----------------------------------------------------------------------------------------------" |
| 47 | echo "Verifying a signature with additional restrictions..." | 63 | echo "Verifying a signature using X509 certificates with xmlsec1..." |
| 48 | ./verify4 verify4-res.xml ca2cert.pem cacert.pem | 64 | xmlsec1 verify --untrusted ca2cert.pem --trusted cacert.pem sign3-res.xml |
| 49 | check_return verify-res | 65 | check_return verify-x509-xmlsec1 |
| 66 | |||
| 67 | echo "-----------------------------------------------------------------------------------------------" | ||
| 68 | echo "Verifying a signature over a node using X509 certificate..." | ||
| 69 | ./verify4 sign4-res.xml "data" ca2cert.pem cacert.pem | ||
| 70 | check_return verify-node-x509 | ||
| 71 | |||
| 72 | echo "-----------------------------------------------------------------------------------------------" | ||
| 73 | echo "Verifying a signature over a node using X509 certificate with xmlsec1..." | ||
| 74 | xmlsec1 verify --add-id-attr ID --untrusted ca2cert.pem --trusted cacert.pem sign4-res.xml | ||
| 75 | check_return verify-node-x509-xmlsec1 | ||
| 50 | 76 | ||
| 51 | echo "---------------------------------------------------" | 77 | echo "-----------------------------------------------------------------------------------------------" |
| 78 | echo "Verifying a simple SAML response using X509 certificate..." | ||
| 79 | ./verify-saml verify-saml-res.xml ca2cert.pem cacert.pem | ||
| 80 | check_return verify-sampl-x509 | ||
| 81 | |||
| 82 | echo "-----------------------------------------------------------------------------------------------" | ||
| 83 | echo "Verifying a simple SAML response using X509 certificate with xmlsec1..." | ||
| 84 | xmlsec1 verify --trusted ca2cert.pem --trusted cacert.pem verify-saml-res.xml | ||
| 85 | check_return verify-sampl-x509-xmlsec1 | ||
| 86 | |||
| 87 | echo "-----------------------------------------------------------------------------------------------" | ||
| 52 | echo "Encrypting data with a template file..." | 88 | echo "Encrypting data with a template file..." |
| 53 | ./encrypt1 encrypt1-tmpl.xml deskey.bin > encrypt1-res.xml | 89 | ./encrypt1 encrypt1-tmpl.xml deskey.bin > encrypt1-res.xml |
| 54 | ./decrypt1 encrypt1-res.xml deskey.bin | ||
| 55 | check_return encrypt-tmpl | 90 | check_return encrypt-tmpl |
| 56 | 91 | ||
| 57 | echo "---------------------------------------------------" | 92 | echo "-----------------------------------------------------------------------------------------------" |
| 93 | echo "Encrypting data with a template file with xmlsec1..." | ||
| 94 | xmlsec1 encrypt --deskey:deskey.bin deskey.bin --binary-data binary.dat --output encrypt1-res-xmlsec1.xml encrypt1-tmpl.xml | ||
| 95 | check_return encrypt-tmpl-xmlsec1 | ||
| 96 | |||
| 97 | echo "-----------------------------------------------------------------------------------------------" | ||
| 58 | echo "Encrypting data with a dynamicaly created template..." | 98 | echo "Encrypting data with a dynamicaly created template..." |
| 59 | ./encrypt2 encrypt2-doc.xml deskey.bin > encrypt2-res.xml | 99 | ./encrypt2 encrypt2-doc.xml deskey.bin > encrypt2-res.xml |
| 60 | ./decrypt1 encrypt2-res.xml deskey.bin | ||
| 61 | check_return encrypt-dynamic-tmpl | 100 | check_return encrypt-dynamic-tmpl |
| 62 | 101 | ||
| 63 | echo "---------------------------------------------------" | 102 | echo "-----------------------------------------------------------------------------------------------" |
| 64 | echo "Encrypting data with a session key..." | 103 | echo "Encrypting data with a session key..." |
| 65 | ./encrypt3 encrypt3-doc.xml rsakey.pem > encrypt3-res.xml | 104 | ./encrypt3 encrypt3-doc.xml rsakey.pem > encrypt3-res.xml |
| 66 | ./decrypt3 encrypt3-res.xml | ||
| 67 | check_return encrypt-session-key | 105 | check_return encrypt-session-key |
| 68 | 106 | ||
| 69 | echo "---------------------------------------------------" | 107 | echo "-----------------------------------------------------------------------------------------------" |
| 70 | echo "Decrypting data with a single key..." | 108 | echo "Decrypting data with a single key..." |
| 71 | ./decrypt1 encrypt1-res.xml deskey.bin | 109 | ./decrypt1 encrypt1-res.xml deskey.bin |
| 110 | check_return decrypt-single-key-1 | ||
| 72 | ./decrypt1 encrypt2-res.xml deskey.bin | 111 | ./decrypt1 encrypt2-res.xml deskey.bin |
| 73 | check_return encrypt-single-key | 112 | check_return decrypt-single-key-2 |
| 74 | 113 | ||
| 75 | echo "---------------------------------------------------" | 114 | echo "-----------------------------------------------------------------------------------------------" |
| 76 | echo "Decrypting data with keys manager..." | 115 | echo "Decrypting data with keys manager..." |
| 77 | ./decrypt2 encrypt1-res.xml deskey.bin | 116 | ./decrypt2 encrypt1-res.xml deskey.bin |
| 117 | check_return decrypt-keys-1-manager | ||
| 78 | ./decrypt2 encrypt2-res.xml deskey.bin | 118 | ./decrypt2 encrypt2-res.xml deskey.bin |
| 79 | check_return encrypt-keys-manager | 119 | check_return decrypt-keys-2-manager |
| 80 | 120 | ||
| 81 | echo "---------------------------------------------------" | 121 | echo "-----------------------------------------------------------------------------------------------" |
| 82 | echo "Writing a custom keys manager..." | 122 | echo "Decrypting data with xmlsec1..." |
| 123 | xmlsec1 decrypt --deskey:deskey.bin deskey.bin encrypt1-res-xmlsec1.xml | ||
| 124 | check_return decrypt-key-1-xmlsec1 | ||
| 125 | xmlsec1 decrypt --deskey:deskey.bin deskey.bin encrypt2-res.xml | ||
| 126 | check_return decrypt-key-2-xmlsec1 | ||
| 127 | xmlsec1 decrypt --privkey:rsakey.pem rsakey.pem encrypt3-res.xml | ||
| 128 | check_return decrypt-key-3-xmlsec1 | ||
| 129 | |||
| 130 | echo "-----------------------------------------------------------------------------------------------" | ||
| 131 | echo "Decrypting using custom keys manager..." | ||
| 83 | ./decrypt3 encrypt1-res.xml | 132 | ./decrypt3 encrypt1-res.xml |
| 133 | check_return decrypt-keys-1-manager | ||
| 84 | ./decrypt3 encrypt2-res.xml | 134 | ./decrypt3 encrypt2-res.xml |
| 85 | check_return write-keys-manager | 135 | check_return decrypt-keys-2-manager |
| 136 | ./decrypt3 encrypt3-res.xml | ||
| 137 | check_return decrypt-keys-3-manager | ||
diff --git a/meta-oe/recipes-support/xmlsec1/xmlsec1_1.3.7.bb b/meta-oe/recipes-support/xmlsec1/xmlsec1_1.3.9.bb index 1990444dcc..ca6ebba59c 100644 --- a/meta-oe/recipes-support/xmlsec1/xmlsec1_1.3.7.bb +++ b/meta-oe/recipes-support/xmlsec1/xmlsec1_1.3.9.bb | |||
| @@ -13,16 +13,17 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=352791d62092ea8104f085042de7f4d0" | |||
| 13 | SECTION = "libs" | 13 | SECTION = "libs" |
| 14 | 14 | ||
| 15 | SRC_URI = "https://github.com/lsh123/xmlsec/releases/download/${PV}/${BP}.tar.gz \ | 15 | SRC_URI = "https://github.com/lsh123/xmlsec/releases/download/${PV}/${BP}.tar.gz \ |
| 16 | file://fix-ltmain.sh.patch \ | 16 | file://0001-force-to-use-our-own-libtool.patch \ |
| 17 | file://change-finding-path-of-nss.patch \ | 17 | file://0002-change-finding-path-of-nss-and-nspr.patch \ |
| 18 | file://makefile-ptest.patch \ | 18 | file://0003-xmlsec1-add-new-recipe.patch \ |
| 19 | file://xmlsec1-examples-allow-build-in-separate-dir.patch \ | 19 | file://0004-examples-allow-build-in-separate-dir.patch \ |
| 20 | file://0001-nss-nspr-fix-for-multilib.patch \ | 20 | file://0005-nss-nspr-fix-for-multilib.patch \ |
| 21 | file://0006-xmlsec1-Fix-configure-QA-error-caused-by-host-lookup.patch \ | ||
| 22 | file://0007-xmlsec-examples-Fix-LibXML2-deprecation-warnings-and.patch \ | ||
| 21 | file://run-ptest \ | 23 | file://run-ptest \ |
| 22 | file://ensure-search-path-non-host.patch \ | ||
| 23 | " | 24 | " |
| 24 | 25 | ||
| 25 | SRC_URI[sha256sum] = "d82e93b69b8aa205a616b62917a269322bf63a3eaafb3775014e61752b2013ea" | 26 | SRC_URI[sha256sum] = "a631c8cd7a6b86e6adb9f5b935d45a9cf9768b3cb090d461e8eb9d043cf9b62f" |
| 26 | 27 | ||
| 27 | UPSTREAM_CHECK_URI = "https://github.com/lsh123/xmlsec/releases" | 28 | UPSTREAM_CHECK_URI = "https://github.com/lsh123/xmlsec/releases" |
| 28 | UPSTREAM_CHECK_REGEX = "releases/tag/(?P<pver>\d+(\.\d+)+)" | 29 | UPSTREAM_CHECK_REGEX = "releases/tag/(?P<pver>\d+(\.\d+)+)" |
