@Test
void v3CaCert() throws Exception
{

    CertifiedPublicKey certificate = factory.decode(v3CaCert);
    assertTrue(certificate.isSignedBy(certificate.getPublicKeyParameters()), "CA should verify itself.");
    assertThat(certificate, instanceOf(X509CertifiedPublicKey.class));
    X509CertifiedPublicKey cert = (X509CertifiedPublicKey) certificate;
    assertThat(cert.getVersionNumber(), equalTo(3));
    assertTrue(cert.getExtensions().isCritical(X509Extensions.BASIC_CONSTRAINTS_OID),
        "Basic constraints should be critical.");
    assertTrue(cert.getExtensions().hasCertificateAuthorityBasicConstraints(),
        "Basic constraints should be set to CA.");
    assertTrue(cert.getExtensions().isCritical(KeyUsage.OID),
        "KeyUsage extension should be critical.");
    assertThat(cert.getExtensions().getKeyUsage(), equalTo(EnumSet.of(KeyUsage.keyCertSign,
        KeyUsage.cRLSign)));
    assertThat(cert.getAuthorityKeyIdentifier(), notNullValue());
    assertThat(cert.getAuthorityKeyIdentifier(),
        equalTo(cert.getSubjectKeyIdentifier()));
    assertThat(cert.isRootCA(), equalTo(true));
}