Use JKS : JKS « Security « Java Tutorial






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);

  }
}








36.19.JKS
36.19.1.Use JKS
36.19.2.Use JKS KeyStore to load key
36.19.3.JKS: List aliases
36.19.4.JKS keystore: get certificate chain