mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-19 04:58:00 +00:00
Modify gateway class to generate a detached signature for a signed swidtag. Created new unit test and updated test resource files.
This commit is contained in:
parent
f464519235
commit
681fc92a3c
@ -656,17 +656,8 @@ public class SwidTagGateway {
|
||||
}
|
||||
KeyInfo keyinfo = kiFactory.newKeyInfo(keyInfoElements);
|
||||
|
||||
Document detachedSignature = null;
|
||||
try {
|
||||
detachedSignature = DocumentBuilderFactory.newInstance()
|
||||
.newDocumentBuilder().newDocument();
|
||||
} catch (ParserConfigurationException e) {
|
||||
System.out.println("Error creating new document object: " + e.getMessage());
|
||||
}
|
||||
detachedSignature.setXmlVersion("1.0");
|
||||
detachedSignature.appendChild(detachedSignature.createElement("root"));
|
||||
DOMSignContext context = new DOMSignContext(privateKey,
|
||||
detachedSignature.getDocumentElement());
|
||||
Document detachedSignature = db.newDocument();
|
||||
DOMSignContext context = new DOMSignContext(privateKey, detachedSignature);
|
||||
context.setIdAttributeNS(softwareIdentity, null, "id");
|
||||
XMLSignature signature = sigFactory.newXMLSignature(signedInfo, keyinfo);
|
||||
try {
|
||||
@ -675,7 +666,6 @@ public class SwidTagGateway {
|
||||
System.out.println("Error while signing SoftwareIdentity");
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Detached signature: " + detachedSignature);
|
||||
|
||||
return detachedSignature;
|
||||
}
|
||||
|
@ -175,6 +175,7 @@ public class TestSwidTagGateway {
|
||||
gateway.setDefaultCredentials(true);
|
||||
Document doc = gateway.signXMLDocument(signFilePath);
|
||||
gateway.writeSwidTagFile(doc, DEFAULT_OUTPUT);
|
||||
validator.validateSwidTag(DEFAULT_OUTPUT, "DEFAULT");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user