aboutsummaryrefslogtreecommitdiff
path: root/src/main/ui/IssueScreen.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/ui/IssueScreen.java')
-rw-r--r--src/main/ui/IssueScreen.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/ui/IssueScreen.java b/src/main/ui/IssueScreen.java
index 5e3ad50..3e70a0a 100644
--- a/src/main/ui/IssueScreen.java
+++ b/src/main/ui/IssueScreen.java
@@ -4,6 +4,7 @@ import model.asn1.exceptions.ParseException;
import model.ca.Template;
import model.csr.CertificationRequest;
import model.pki.cert.Certificate;
+import model.x501.Name;
/**
* The screen that accepts a CSR and template and allows user to change its properties and issue.
@@ -65,6 +66,7 @@ public class IssueScreen implements UIHandler {
public void commit() {
try {
Certificate certificate = session.getCa().signCert(incomingCSR.getCertificationRequestInfo(), template);
+ session.save();
System.out.println(Utils.toPEM(certificate.encodeDER(), "CERTIFICATE"));
session.setScreen(Screen.MAIN);
} catch (Throwable e) {
@@ -78,7 +80,11 @@ public class IssueScreen implements UIHandler {
*/
private void handleIssueSetSubject(String val) {
try {
- template = new Template(template.getName(), template.isEnabled(), val, template.getValidity());
+ if (val == null) {
+ template = new Template(template.getName(), template.isEnabled(), (Name) null, template.getValidity());
+ } else {
+ template = new Template(template.getName(), template.isEnabled(), val, template.getValidity());
+ }
} catch (ParseException e) {
System.out.println(e.getMessage());
}