From f0b8e89bab43fc7873cfee17c955572e6f9f2685 Mon Sep 17 00:00:00 2001 From: chubtub <43381989+chubtub@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:48:51 -0500 Subject: [PATCH] Do not assign the default attributes file in the absence of a user-provided argument --- tools/tcg_rim_tool/src/main/java/hirs/swid/Main.java | 5 ++++- .../tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java | 2 +- .../src/main/java/hirs/swid/utils/Commander.java | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/Main.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/Main.java index 9a55ac55..e36f842f 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/Main.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/Main.java @@ -82,11 +82,14 @@ public class Main { case "BASE": if (!attributesFile.isEmpty()) { gateway.setAttributesFile(attributesFile); + } else { + System.out.println("An attribute file is required."); + System.exit(1); } if (!rimEventLog.isEmpty()) { gateway.setRimEventLog(rimEventLog); } else { - System.out.println("Error: a support RIM is required!"); + System.out.println("A support RIM is required."); System.exit(1); } credValidator = new CredentialArgumentValidator("" , 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 b9027b27..aa9b23d2 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 @@ -99,7 +99,7 @@ public class SwidTagGateway { try { JAXBContext jaxbContext = JAXBContext.newInstance(SwidTagConstants.SCHEMA_PACKAGE); marshaller = jaxbContext.createMarshaller(); - attributesFile = SwidTagConstants.DEFAULT_ATTRIBUTES_FILE; + attributesFile = ""; defaultCredentials = true; pemCertificateFile = ""; embeddedCert = false; diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/Commander.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/Commander.java index 855d9625..1b77c7c7 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/Commander.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/Commander.java @@ -24,7 +24,7 @@ public class Commander { private boolean version = false; @Parameter(names = {"-a", "--attributes "}, order = 1, description = "The configuration file holding attributes " - + "to populate the base RIM with.") + + "to populate the base RIM with. An example file can be found in /opt/rimtool/data.") private String attributesFile = ""; @Parameter(names = {"-o", "--out "}, order = 2, description = "The file to write the RIM out to. " @@ -45,7 +45,7 @@ public class Commander { description = "Embed the provided certificate in the signed swidtag.") private boolean embedded = false; @Parameter(names = {"-d", "--default-key"}, order = 8, - description = "Use default signing credentials.") + description = "Use the JKS keystore installed in /opt/rimtool/data.") private boolean defaultKey = false; @Parameter(names = {"-l", "--rimel "}, order = 9, description = "The TCG eventlog file to use as a support RIM.")