diff options
author | Yuuta Liang <yuutaw@student.cs.ubc.ca> | 2023-10-26 05:00:12 +0800 |
---|---|---|
committer | Yuuta Liang <yuutaw@student.cs.ubc.ca> | 2023-10-26 05:00:12 +0800 |
commit | 578b7d1db256d9a582cef45ae5d13d858a977416 (patch) | |
tree | b856cc5af32a0d649321f501f2966d013cade6c0 /src/main/ui/IssueScreen.java | |
parent | f73bca3372a31f360d894dcbe8580cef779af739 (diff) | |
download | jca-578b7d1db256d9a582cef45ae5d13d858a977416.tar jca-578b7d1db256d9a582cef45ae5d13d858a977416.tar.gz jca-578b7d1db256d9a582cef45ae5d13d858a977416.tar.bz2 jca-578b7d1db256d9a582cef45ae5d13d858a977416.zip |
Add persistence
Signed-off-by: Yuuta Liang <yuutaw@student.cs.ubc.ca>
Diffstat (limited to 'src/main/ui/IssueScreen.java')
-rw-r--r-- | src/main/ui/IssueScreen.java | 8 |
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()); } |