-->

Verify that the leaf certificate was signed by the

2019-09-14 01:21发布

问题:

I have the Apple Root CA - G3 root Certificate and I need to validate the chain of trust. I need to verify that the leaf certificate was signed by the sub-CA certificate.

How can I do this with Java?

回答1:

Use this snippet

X509Certificate certificate =...
X509Certificate intermediate = ...
try{
    certificate.verify(intermediate.getPublicKey());
        //Verification ok.    intermediate  is the issuer
    } catch (Exception e){}
}