import java.util.Collection;
import java.util.List;
+import org.hamcrest.CoreMatchers;
import org.junit.Test;
import club.wpia.gigi.dbObjects.Certificate;
import club.wpia.gigi.dbObjects.Certificate.CSRType;
import club.wpia.gigi.dbObjects.Certificate.CertificateStatus;
+import club.wpia.gigi.dbObjects.Certificate.RevocationType;
import club.wpia.gigi.dbObjects.Certificate.SANType;
import club.wpia.gigi.dbObjects.Certificate.SubjectAlternateName;
import club.wpia.gigi.dbObjects.Digest;
}
}
+ @Test
+ public void testCertCreateSHA384() throws IOException, GeneralSecurityException, SQLException, InterruptedException, GigiApiException {
+ KeyPair kp = generateKeypair();
+ String key = generatePEMCSR(kp, "CN=testmail@example.com");
+ Certificate c = new Certificate(u, u, Certificate.buildDN("CN", "testmail@example.com"), Digest.SHA384, key, CSRType.CSR, getClientProfile());
+ await(c.issue(null, "2y", u));
+ assertThat(c.cert().getSigAlgName().toLowerCase(), CoreMatchers.containsString("sha384"));
+ }
+
@Test
public void testCertLifeCycle() throws IOException, GeneralSecurityException, SQLException, InterruptedException, GigiApiException {
KeyPair kp = generateKeypair();
assertNotNull(login(pk, cert));
assertEquals(1, countRegex(IOUtils.readURL(get(cookie, Certificates.PATH)), "<td>(?:REVOKED|ISSUED)</td>"));
assertEquals(1, countRegex(IOUtils.readURL(get(cookie, Certificates.PATH + "?withRevoked")), "<td>(?:REVOKED|ISSUED)</td>"));
- await(c.revoke());
+ await(c.revoke(RevocationType.USER));
testFails(CertificateStatus.REVOKED, c);
assertNull(login(pk, cert));
assertEquals(status, c.getStatus());
if (status != CertificateStatus.ISSUED) {
try {
- c.revoke();
+ c.revoke(RevocationType.USER);
fail(status + " is in invalid state");
} catch (IllegalStateException ise) {