import java.io.FileInputStream; import java.security.KeyStore; import java.security.cert.Certificate; public class MainClass { public static void main(String args[]) throws Exception { String pass = "wshr.ut"; String alias = "mytest"; String name = "mykeystore"; FileInputStream in = new FileInputStream(name); KeyStore ks = KeyStore.getInstance("JKS"); ks.load(in, pass.toCharArray()); Certificate c = ks.getCertificate(alias); in.close(); System.out.println(c); } }