added "org.bouncycastle.x509.allow_absent_equiv_NULL" support.
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.SecureRandom;
+import java.security.Security;
import java.security.cert.CRL;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
import org.bouncycastle.crypto.util.PublicKeyFactory;
import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.ContentVerifierProvider;
@@ -1476,8 +1478,26 @@ public void testNullDerNullCert()
cert = new X509CertificateHolder(new DERSequence(v).getEncoded());
+ try
+ {
+ System.setProperty("org.bouncycastle.x509.allow_absent_equiv_NULL", "true");
+
assertTrue(cert.isSignatureValid(new BcRSAContentVerifierProviderBuilder(digAlgFinder).build(pubKey)));
}
+ catch (Exception e)
+ {
+ fail(dump + Strings.lineSeparator() + getName() + ": testNullDerNull failed - exception " + e.toString());
+ }
+ finally
+ {
+ System.setProperty("org.bouncycastle.x509.allow_absent_equiv_NULL", "false");
+ }
+ }
+
+ public void setUp()
+ {
+ Security.addProvider(new BouncyCastleProvider());
+ }
public void testCertificates()
throws Exception
