I need to convert extension of ssl certificate from .cer
to .bks
So, I followed this SO answer
I am using cmd
This is my input command :
keytool -importcert -v -trustcacerts -file "C:\Users\alexey.t\Downloads\my_certificates\Root_CA.cer" -alias IntermediateCA -keystore "C:\Users\alexey.t\Downloads\MyApp\app\src\res\raw\myKeystore.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "C:\Users\alexey.t\Downloads\my_certificates\bcprov-ext-jdk15on-1.46.jar" -storetype BKS -storepass mysecret
Certificate already exists in system-wide CA keystore under alias <thawteprimaryrootca [jdk]>
Do you still want to add it to your own keystore? [no]: y
Here is output I get
Certificate was added to keystore
[Storing C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks]
keytool error: java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at sun.security.tools.keytool.Main.doCommands(Unknown Source)
at sun.security.tools.keytool.Main.run(Unknown Source)
at sun.security.tools.keytool.Main.main(Unknown Source)
Also according to SO answer above I can use next command to check if keystore
exist
keytool -list -keystore "C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "C:\Users\alexey.t\Downloads\ElAl_certificates\bcprov-ext-jdk15on-1.46.jar" -storetype BKS -storepass mysecret
Here is output
keytool error: java.lang.Exception: Keystore file does not exist: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks
So, what am I doing wrong?