]> WPIA git - gigi.git/blobdiff - tests/club/wpia/gigi/TestCertificate.java
fix: sha384 certificates
[gigi.git] / tests / club / wpia / gigi / TestCertificate.java
index d791bfd0ee84654ac3a88769530b7befd203ba29..53b6509d38e0cecbe66524f5410c0f451d198e43 100644 (file)
@@ -11,6 +11,7 @@ import java.sql.SQLException;
 import java.util.Collection;
 import java.util.List;
 
+import org.hamcrest.CoreMatchers;
 import org.junit.Test;
 
 import club.wpia.gigi.dbObjects.Certificate;
@@ -93,6 +94,15 @@ public class TestCertificate extends ManagedTest {
         }
     }
 
+    @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();