if (aCert.hasUnsupportedCriticalExtension())
{
fail("unsupported extensions found with no extensions");
}
gen.addExtension("1.1", true, new DEROctetString(new byte[10]));
gen.addExtension("2.2", false, new DEROctetString(new byte[20]));
aCert = gen.generate(privKey, "BC");
Set exts = aCert.getCriticalExtensionOIDs();
if (exts.size() != 1 || !exts.contains("1.1"))
{
fail("critical extension test failed");
}
exts = aCert.getNonCriticalExtensionOIDs();
if (exts.size() != 1 || !exts.contains("2.2"))
{
fail("non-critical extension test failed");
}
if (!aCert.hasUnsupportedCriticalExtension())
{
fail("unsupported extensions not found");
}
byte[] extString = aCert.getExtensionValue("1.1");
ASN1Encodable extValue = X509ExtensionUtil.fromExtensionValue(extString);
if (!extValue.equals(new DEROctetString(new byte[10])))
{
fail("wrong extension value found for 1.1");
}
testCertWithBaseCertificateID();