X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FCertificate.java;h=8094419ba3473f2c95f43bc0f3ac461519ca2e52;hb=736968682d49753f1cfb9cbf0970fe95435f0658;hp=433e60e49b62a5bc6a97444d3ff7f1c104622c59;hpb=3a82aeb3af3e15430268cc1aeb57de66f3dd9b29;p=gigi.git diff --git a/src/org/cacert/gigi/Certificate.java b/src/org/cacert/gigi/Certificate.java index 433e60e4..8094419b 100644 --- a/src/org/cacert/gigi/Certificate.java +++ b/src/org/cacert/gigi/Certificate.java @@ -8,6 +8,7 @@ import java.io.InputStream; import java.security.GeneralSecurityException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; +import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -18,7 +19,6 @@ import java.util.List; import org.cacert.gigi.database.DatabaseConnection; import org.cacert.gigi.util.Job; -import org.cacert.gigi.util.Job.JobType; import org.cacert.gigi.util.KeyStorage; import org.cacert.gigi.util.Notary; @@ -219,7 +219,23 @@ public class Certificate { return CertificateStatus.REVOKED; } - public Job issue() throws IOException, SQLException { + /** + * @param start + * the date from which on the certificate should be valid. (or + * null if it should be valid instantly) + * @param period + * the period for which the date should be valid. (a + * yyyy-mm-dd or a "2y" (2 calendar years), "6m" (6 + * months) + * @return A job which can be used to monitor the progress of this task. + * @throws IOException + * for problems with writing the CSR/SPKAC + * @throws SQLException + * for problems with writing to the DB + * @throws GigiApiException + * if the period is bogus + */ + public Job issue(Date start, String period) throws IOException, SQLException, GigiApiException { if (getStatus() != CertificateStatus.DRAFT) { throw new IllegalStateException(); } @@ -252,7 +268,7 @@ public class Certificate { updater.setString(1, csrName); updater.setInt(2, id); updater.execute(); - return Job.submit(this, JobType.SIGN); + return Job.sign(this, start, period); } @@ -260,7 +276,7 @@ public class Certificate { if (getStatus() != CertificateStatus.ISSUED) { throw new IllegalStateException(); } - return Job.submit(this, JobType.REVOKE); + return Job.revoke(this); }