mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-02-06 19:19:59 +00:00
Modify Main and Commander classes to support options for RFC3161 and RFC3339
This commit is contained in:
parent
1fccd3a222
commit
97ccab0473
@ -81,6 +81,11 @@ public class Main {
|
|||||||
} else {
|
} else {
|
||||||
gateway.setRimEventLog(rimEventLog);
|
gateway.setRimEventLog(rimEventLog);
|
||||||
}
|
}
|
||||||
|
if (commander.isRfc3161()) {
|
||||||
|
gateway.setTimestampFormat("RFC3161");
|
||||||
|
} else {
|
||||||
|
gateway.setTimestampFormat("RFC3339");
|
||||||
|
}
|
||||||
gateway.generateSwidTag(commander.getOutFile());
|
gateway.generateSwidTag(commander.getOutFile());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -86,6 +86,7 @@ public class SwidTagGateway {
|
|||||||
private String pemCertificateFile;
|
private String pemCertificateFile;
|
||||||
private boolean embeddedCert;
|
private boolean embeddedCert;
|
||||||
private String rimEventLog;
|
private String rimEventLog;
|
||||||
|
private String timestampFormat;
|
||||||
private String errorRequiredFields;
|
private String errorRequiredFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,6 +101,7 @@ public class SwidTagGateway {
|
|||||||
pemCertificateFile = "";
|
pemCertificateFile = "";
|
||||||
embeddedCert = false;
|
embeddedCert = false;
|
||||||
rimEventLog = "";
|
rimEventLog = "";
|
||||||
|
timestampFormat = "";
|
||||||
errorRequiredFields = "";
|
errorRequiredFields = "";
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
System.out.println("Error initializing jaxbcontext: " + e.getMessage());
|
System.out.println("Error initializing jaxbcontext: " + e.getMessage());
|
||||||
@ -170,6 +172,14 @@ public class SwidTagGateway {
|
|||||||
this.rimEventLog = rimEventLog;
|
this.rimEventLog = rimEventLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for timestamp format in XML signature
|
||||||
|
* @param timestampFormat
|
||||||
|
*/
|
||||||
|
public void setTimestampFormat(String timestampFormat) {
|
||||||
|
this.timestampFormat = timestampFormat;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method generates a base RIM from the values in a JSON file.
|
* This method generates a base RIM from the values in a JSON file.
|
||||||
*
|
*
|
||||||
|
@ -45,6 +45,12 @@ public class Commander {
|
|||||||
@Parameter(names = {"-l", "--rimel <path>"}, order = 9,
|
@Parameter(names = {"-l", "--rimel <path>"}, order = 9,
|
||||||
description = "The TCG eventlog file to use as a support RIM.")
|
description = "The TCG eventlog file to use as a support RIM.")
|
||||||
private String rimEventLog = "";
|
private String rimEventLog = "";
|
||||||
|
@Parameter(names = {"--rfc3161"}, order = 10,
|
||||||
|
description = "Add a timestamp to the signature that is compliant with RFC3161.")
|
||||||
|
private boolean rfc3161 = false;
|
||||||
|
@Parameter(names = {"--rfc3339"}, order = 11,
|
||||||
|
description = "Add a timestamp to the signature that is compliant with RFC3339.")
|
||||||
|
private boolean rfc3339 = false;
|
||||||
|
|
||||||
public boolean isHelp() {
|
public boolean isHelp() {
|
||||||
return help;
|
return help;
|
||||||
@ -82,6 +88,10 @@ public class Commander {
|
|||||||
|
|
||||||
public String getRimEventLog() { return rimEventLog; }
|
public String getRimEventLog() { return rimEventLog; }
|
||||||
|
|
||||||
|
public boolean isRfc3161() { return rfc3161; }
|
||||||
|
|
||||||
|
public boolean isRfc3339() { return rfc3339; }
|
||||||
|
|
||||||
public String printHelpExamples() {
|
public String printHelpExamples() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Create a base RIM using the values in attributes.json; " +
|
sb.append("Create a base RIM using the values in attributes.json; " +
|
||||||
@ -123,6 +133,13 @@ public class Commander {
|
|||||||
sb.append("Signing credential: (none given)" + System.lineSeparator());
|
sb.append("Signing credential: (none given)" + System.lineSeparator());
|
||||||
}
|
}
|
||||||
sb.append("Event log support RIM: " + this.getRimEventLog() + System.lineSeparator());
|
sb.append("Event log support RIM: " + this.getRimEventLog() + System.lineSeparator());
|
||||||
|
if (isRfc3161()) {
|
||||||
|
sb.append("Timestamp format: RFC3161");
|
||||||
|
} else if (isRfc3339()) {
|
||||||
|
sb.append("Timestamp format: RFC3339");
|
||||||
|
} else {
|
||||||
|
sb.append("Timestamp format: defaulting to RFC3339");
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user