问题
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){}
}
来源:https://stackoverflow.com/questions/42287576/verify-that-the-leaf-certificate-was-signed-by-the-sub-ca-certificate