I have a CRL and a self-signed certificate that acts as a CA Certificate. I need to verify that the same CA has issued both the CRL and the root certificate in Java. The way I thought of was this:
X500Principal rootCertIssuer = rootCertificate.getIssuerX500Principal();
X500Principal crlIssuer = crl.getIssuerX500Principal();
if(rootCertIssuer.getName().equals(crlIssuer.getName()))
System.out.println("Issuer same!");
else
System.out.println("Issuer different!");
This does not seem right, because in case Country/State information is missing in one of either the CRL or the root certificate, equals()
will return a false
. How do I proceed? Or, opposed to what I think, is this approach right?
Thank you!