Add commandline support for passing in a countersignature file for RFC3852 timestamps

This commit is contained in:
chubtub 2022-12-07 19:47:30 -05:00
parent 2252270d94
commit 054699d14d
2 changed files with 10 additions and 7 deletions

View File

@ -79,8 +79,11 @@ public class Main {
} else {
gateway.setRimEventLog(rimEventLog);
}
if (commander.isRfc3852()) {
gateway.setTimestampFormat("RFC3852");
if (!commander.getRfc3852Filename().isEmpty() && commander.isRfc3339()) {
System.out.println("Only one timestamp format can be specified");
System.exit(1);
} else if (!commander.getRfc3852Filename().isEmpty()) {
//pass file to gateway
} else if (commander.isRfc3339()) {
gateway.setTimestampFormat("RFC3339");
}

View File

@ -47,7 +47,7 @@ public class Commander {
private String rimEventLog = "";
@Parameter(names = {"--rfc3852"}, order = 10,
description = "Add a placeholder for a base 64-encoded RFC3852 countersignature.")
private boolean rfc3852 = false;
private String rfc3852Filename = "";
@Parameter(names = {"--rfc3339"}, order = 11,
description = "Add a timestamp to the signature that is compliant with RFC3339.")
private boolean rfc3339 = false;
@ -88,7 +88,7 @@ public class Commander {
public String getRimEventLog() { return rimEventLog; }
public boolean isRfc3852() { return rfc3852; }
public String getRfc3852Filename() { return rfc3852Filename; }
public boolean isRfc3339() { return rfc3339; }
@ -133,12 +133,12 @@ public class Commander {
sb.append("Signing credential: (none given)" + System.lineSeparator());
}
sb.append("Event log support RIM: " + this.getRimEventLog() + System.lineSeparator());
if (isRfc3852()) {
if (!this.getRfc3852Filename().isEmpty()) {
sb.append("Timestamp format: RFC3852");
} else if (isRfc3339()) {
} else if (this.isRfc3339()) {
sb.append("Timestamp format: RFC3339");
} else {
sb.append("No timestamp included");
sb.append("No timestamp specified");
}
return sb.toString();
}