From 027d8d299bcb6c568ed8a1b4834342d6e9d40088 Mon Sep 17 00:00:00 2001 From: peppelinux Date: Tue, 15 Dec 2020 17:03:25 +0100 Subject: [PATCH] metadata_tostring_fix handle and return only strings --- tools/make_metadata.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/make_metadata.py b/tools/make_metadata.py index 147425fe5..856f80b60 100755 --- a/tools/make_metadata.py +++ b/tools/make_metadata.py @@ -34,6 +34,12 @@ help="xmlsec binaries to be used for the signing") parser.add_argument('-w', dest='wellknown', help="Use wellknown namespace prefixes") +parser.add_argument('-S', dest='signalg', + default='http://www.w3.org/2000/09/xmldsig#rsa-sha1', + help="Algorithm to sign the metadata") +parser.add_argument('-D', dest='digestalg', + default='http://www.w3.org/2000/09/xmldsig#sha1', + help="Algorithm to compute the digest of the metadata") parser.add_argument(dest="config", nargs="+") args = parser.parse_args() @@ -70,16 +76,19 @@ args.sign, secc) valid_instance(desc) xmldoc = metadata_tostring_fix(desc, nspair, xmldoc) - print(xmldoc.decode("utf-8")) + print(xmldoc) else: for eid in eds: if args.sign: assert conf.key_file assert conf.cert_file - eid, xmldoc = sign_entity_descriptor(eid, args.id, secc) + sign_alg = args.signalg + digest_alg = args.digestalg + eid, xmldoc = sign_entity_descriptor(eid, args.id, secc, sign_alg, + digest_alg) else: xmldoc = None valid_instance(eid) xmldoc = metadata_tostring_fix(eid, nspair, xmldoc) - print(xmldoc.decode("utf-8")) + print(xmldoc)