Java examples for Security:Key
load KeyStore from File
//package com.java2s; import java.io.FileInputStream; import java.security.KeyStore; public class Main { public static void main(String[] argv) throws Exception { String keyStorePath = "java2s.com"; String password = "java2s.com"; System.out.println(getKeyStore(keyStorePath, password)); }// ww w . j a v a 2 s .c o m public static final String KEY_STORE = "JKS"; public static KeyStore getKeyStore(String keyStorePath, String password) throws Exception { FileInputStream is = new FileInputStream(keyStorePath); KeyStore ks = KeyStore.getInstance(KEY_STORE); ks.load(is, password.toCharArray()); is.close(); return ks; } }