Search in sources :

Example 11 with CertificateAttribute

use of de.trustable.ca3s.core.domain.CertificateAttribute in project ca3sCore by kuehne-trustable-de.

the class CertificateUtilIntTest method testBuildCertificateWithSAN.

@Test
public void testBuildCertificateWithSAN() throws GeneralSecurityException, IOException {
    String executionId = "";
    Certificate cert = certificateUtil.createCertificate(testCertWithSAN, null, executionId);
    assertNotNull(cert);
    assertFalse(cert.getSans().isEmpty());
    assertEquals("ca@trustable.de", cert.getSans());
    boolean sanPresent = false;
    for (CertificateAttribute certAtt : cert.getCertificateAttributes()) {
        if (CertificateAttribute.ATTRIBUTE_SAN.equals(certAtt.getName())) {
            assertEquals("ca@trustable.de", certAtt.getValue());
            System.out.println("::: " + certAtt.getValue());
            sanPresent = true;
        }
    }
    assertTrue(sanPresent);
}
Also used : X509Certificate(java.security.cert.X509Certificate) Certificate(de.trustable.ca3s.core.domain.Certificate) CertificateAttribute(de.trustable.ca3s.core.domain.CertificateAttribute) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

CertificateAttribute (de.trustable.ca3s.core.domain.CertificateAttribute)11 Test (org.junit.jupiter.api.Test)8 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)8 Certificate (de.trustable.ca3s.core.domain.Certificate)6 X509Certificate (java.security.cert.X509Certificate)6 BadRequestAlertException (de.trustable.ca3s.core.web.rest.errors.BadRequestAlertException)2 Transactional (org.springframework.transaction.annotation.Transactional)2 IOException (java.io.IOException)1 BigInteger (java.math.BigInteger)1 URI (java.net.URI)1 CRLException (java.security.cert.CRLException)1 CertificateException (java.security.cert.CertificateException)1 X509CRL (java.security.cert.X509CRL)1 X509CRLEntry (java.security.cert.X509CRLEntry)1 NamingException (javax.naming.NamingException)1