From 578b7d1db256d9a582cef45ae5d13d858a977416 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Thu, 26 Oct 2023 05:00:12 +0800 Subject: Add persistence Signed-off-by: Yuuta Liang --- src/main/ui/IssueScreen.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/ui/IssueScreen.java') 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()); } -- cgit v1.2.3