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 f1d2c540..56c911e0 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 @@ -63,6 +63,9 @@ public class Main { gateway.setDefaultCredentials(false); gateway.setPemCertificateFile(certificateFile); gateway.setPemPrivateKeyFile(privateKeyFile); + } else { + gateway.setDefaultCredentials(true); + gateway.setJksKeystoreFile(SwidTagConstants.DEFAULT_KEYSTORE_FILE); } if (rimEventLog.isEmpty()) { System.out.println("Error: a support RIM is required!"); diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagConstants.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagConstants.java index 6d5721de..0342ca9c 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagConstants.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagConstants.java @@ -12,6 +12,7 @@ import javax.xml.namespace.QName; */ public class SwidTagConstants { + public static final String DEFAULT_KEYSTORE_FILE = "/opt/hirs/rimtool/keystore.jks"; public static final String DEFAULT_KEYSTORE_PASSWORD = "password"; public static final String DEFAULT_PRIVATE_KEY_ALIAS = "selfsigned"; public static final String DEFAULT_ATTRIBUTES_FILE = "rim_fields.json"; 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 d267d59e..d18282e5 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 @@ -7,6 +7,7 @@ import java.nio.file.InvalidPathException; import java.nio.file.Paths; import com.beust.jcommander.Parameter; +import hirs.swid.SwidTagConstants; /** * Commander is a class that handles the command line arguments for the SWID @@ -115,13 +116,21 @@ public class Commander { } public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("Creating: " + getCreateType() + System.lineSeparator()); - sb.append("Using attributes file: " + getAttributesFile() + System.lineSeparator()); - sb.append("Write to: " + getOutFile() + System.lineSeparator()); - sb.append("Verify file: " + getVerifyFile() + System.lineSeparator()); - sb.append("Private key file: " + getPrivateKeyFile() + System.lineSeparator()); - sb.append("Public certificate: " + getPublicCertificate() + System.lineSeparator()); - sb.append("Event log support RIM: " + getRimEventLog() + System.lineSeparator()); + sb.append("Creating: " + this.getCreateType() + System.lineSeparator()); + sb.append("Using attributes file: " + this.getAttributesFile() + System.lineSeparator()); + sb.append("Write to: " + this.getOutFile() + System.lineSeparator()); + sb.append("Verify file: " + this.getVerifyFile() + System.lineSeparator()); + if (!this.getKeystoreFile().isEmpty()) { + sb.append("Keystore file: " + this.getKeystoreFile() + System.lineSeparator()); + } else if (!this.getPrivateKeyFile().isEmpty() && + !this.getPublicCertificate().isEmpty()) { + sb.append("Private key file: " + this.getPrivateKeyFile() + System.lineSeparator()); + sb.append("Public certificate: " + this.getPublicCertificate() + System.lineSeparator()); + } else { + sb.append("Keystore file: default (" + SwidTagConstants.DEFAULT_KEYSTORE_FILE + ")" + + System.lineSeparator()); + } + sb.append("Event log support RIM: " + this.getRimEventLog() + System.lineSeparator()); /* sb.append("TPM PCRs support RIM: " + getRimPcrs() + System.lineSeparator()); sb.append("Base RIM to be signed: " + getToBeSigned() + System.lineSeparator());