Use JKS KeyStore to load key : JKS « Security « Java Tutorial






import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.KeyStore;

public class MainClass {
  public static void main(String args[]) throws Exception {
    char[] oldpass = args[0].toCharArray();
    char[] newpass = args[1].toCharArray();
    String name = "mykeystore";
    FileInputStream in = new FileInputStream(name);
    KeyStore ks = KeyStore.getInstance("JKS");
    ks.load(in, oldpass);
    in.close();
    FileOutputStream output = new FileOutputStream(name);
    ks.store(output, newpass);
    output.close();
  }
}








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