Reputation: 474
I created a keystore with the name keys
using terminal
keytool -genkey -alias demo -keyalg RSA –keysize 2048 -keystore keys
I want to load this keystore in my java code:
ks = KeyStore.getInstance(KeyStore.getDefaultType());
java.io.FileInputStream fis = null;
try {
fis = new java.io.FileInputStream("keys");
ks.load(fis, password.toCharArray());
} finally {
if (fis != null) {
fis.close();
}
}
I don't know the path to my keystore 'keys'. The only verified path I know is of the trusted keystore
/usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts
which I don't think has my alias demo. How do I load my keysore in the code?
Thanks in advance
Upvotes: 4
Views: 6808
Reputation: 474
Found my all the self-generated keystores in my home folder or the directory in which I was working
/path to my working directory/keystore_name
/home/user name/keystore_name
Upvotes: 10