From e7889ca5fb0239e5a9de370b86a04ecb3567e547 Mon Sep 17 00:00:00 2001 From: chubtub <43381989+chubtub@users.noreply.github.com> Date: Mon, 6 May 2024 12:24:10 -0400 Subject: [PATCH] Declare namespace for TimeStamp element --- .../tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java index 43e4d7f8..a0e9a4c3 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java @@ -712,12 +712,13 @@ public class SwidTagGateway { * @return an XMLObject containing the timestamp element */ private XMLObject createXmlTimestamp(Document doc, XMLSignatureFactory sigFactory) { - Element timeStampElement = doc.createElement("TimeStamp"); + Element timeStampElement = null; switch (timestampFormat.toUpperCase()) { case "RFC3852": try { byte[] counterSignature = Base64.getEncoder().encode( Files.readAllBytes(Paths.get(timestampArgument))); + timeStampElement = doc.createElementNS(SwidTagConstants.RFC3852_NS, "TimeStamp"); timeStampElement.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" + SwidTagConstants.RFC3852_PFX, SwidTagConstants.RFC3852_NS); @@ -729,6 +730,7 @@ public class SwidTagGateway { } break; case "RFC3339": + timeStampElement = doc.createElementNS(SwidTagConstants.RFC3339_NS, "TimeStamp"); timeStampElement.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" + SwidTagConstants.RFC3339_PFX, SwidTagConstants.RFC3339_NS);