密钥库:系统找不到指定的路径

时间:2017-10-22 08:12:30

标签: java android ssl-certificate keytool jsse

我需要将ssl证书的扩展名从.cer转换为.bks

所以,我按照这个SO回答

How to convert .cer to BKS

我正在使用cmd

这是我的输入命令:

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

这是我得到的输出

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)

同样根据上面的答案,我可以使用下一个命令来检查keystore是否存在

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

这是输出

keytool error: java.lang.Exception: Keystore file does not exist: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks

那么,我做错了什么?

0 个答案:

没有答案