Forum Discussion

prachik's avatar
prachik
New Contributor
7 years ago

Accessing Jks(Java Keystore) file in Script

Hi All,

I want to retrieve the private key stored in Jks file using the java KeyStore class in script snap.

I have uploaded the Jks file in the files section of my project. Now, using the FileInputStream I try to load the jks file in Script snap, but I always get the error that “No such file or directory found”. I have tried various permutations for the file path but in vain. Could someone help me and suggest what should be the file path. Or is there any other way to read the Jks file.

Below is my python script code :

keystore=java.security.KeyStore.getInstance("JKS")
keyPassword="123456"
charArray=list(keyPassword)
stream =java.io.FileInputStream("sldb:\\\MyFile.jks");
keystore.load(stream,charArray)