import
java.security.*;
import
java.security.cert.*;
import
java.util.*;
import
java.io.*;
public
class
GFG {
public
static
void
main(String[] argv)
{
try
{
KeyStore sr = KeyStore.getInstance(
"JKS"
);
char
[] pass = (
"123456"
).toCharArray();
InputStream is
=
new
FileInputStream(
"f:/java/private key.store"
);
sr.load(is, pass);
Enumeration<String> e = sr.aliases();
System.out.println(
"List of all the alias present"
);
while
(e.hasMoreElements()) {
System.out.print(e.nextElement() +
""
);
System.out.println();
}
}
catch
(NoSuchAlgorithmException e) {
System.out.println(
"Exception thrown : "
+ e);
}
catch
(NullPointerException e) {
System.out.println(
"Exception thrown : "
+ e);
}
catch
(KeyStoreException e) {
System.out.println(
"Exception thrown : "
+ e);
}
catch
(FileNotFoundException e) {
System.out.println(
"Exception thrown : "
+ e);
}
catch
(IOException e) {
System.out.println(
"Exception thrown : "
+ e);
}
catch
(CertificateException e) {
System.out.println(
"Exception thrown : "
+ e);
}
}
}