Skip to content

Commit

Permalink
Declare namespace for TimeStamp element
Browse files Browse the repository at this point in the history
  • Loading branch information
chubtub committed May 6, 2024
1 parent eb8dd33 commit 0469cce
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -712,12 +712,13 @@ private Document signXMLDocument(Document doc) {
* @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);
Expand All @@ -729,6 +730,7 @@ private XMLObject createXmlTimestamp(Document doc, XMLSignatureFactory sigFactor
}
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);
Expand Down

0 comments on commit 0469cce

Please sign in to comment.