I want to make a small program that gets as inputs (1) A X509 Certificate (2) the corresponding CA that signed this certificate. It should verify this certificate if it is intact or not by verifying the signature. To do so, I believe first I need to extract two things: (1) The Signature Value (2) the remaining certificate fields. The following code works fine for getting the public key but I need the signature value for my purpose.
URL httpslink = new URL("https://mail.yahoo.com");
HttpsURLConnection con = (HttpsURLConnection) httpslink.openConnection();
con.connect();
Certificate ct[] = con.getServerCertificates();
X509Certificate c = ((X509Certificate) ct[0]);
System.out.println(c.getPublicKey().toString());
I tried many ways to get the signature value but I failed. Can you guys give me at least a hit to do so. THANK YOU