Declare namespace for TimeStamp element

This commit is contained in:
chubtub 2024-05-06 12:24:10 -04:00
parent f875a2c981
commit e7889ca5fb

View File

@ -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);