mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-18 18:56:29 +00:00
Restructure try/catch blocks for readability
This commit is contained in:
parent
1a5673a29b
commit
f464519235
@ -656,8 +656,17 @@ public class SwidTagGateway {
|
||||
}
|
||||
KeyInfo keyinfo = kiFactory.newKeyInfo(keyInfoElements);
|
||||
|
||||
Document detachedSignature = db.newDocument();
|
||||
DOMSignContext context = new DOMSignContext(privateKey, detachedSignature);
|
||||
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());
|
||||
context.setIdAttributeNS(softwareIdentity, null, "id");
|
||||
XMLSignature signature = sigFactory.newXMLSignature(signedInfo, keyinfo);
|
||||
try {
|
||||
@ -666,6 +675,7 @@ public class SwidTagGateway {
|
||||
System.out.println("Error while signing SoftwareIdentity");
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Detached signature: " + detachedSignature);
|
||||
|
||||
return detachedSignature;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user