本文介绍了将.cer格式的证书添加到.bks密钥库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将.cer格式的证书添加到BKS密钥库中

I need to add certificate in .cer format to into BKS key store

这里有SO描述

我做了下一步,创建一个目录并放入下一个文件:

I did next, create a dir and put inside next files :


  • keytool.exe

  • bcprov-ext-jdk15on-1.46.jar

  • Root_CA.cer

接下来打开Windows PowerShell并输入此命令(只替换为我的数据)

Next opening Windows PowerShell and put this command(just replacing to my data)

.\keytool -importcert -v -trustcacerts -file "path_to_cert/interm_ca.cer"
-alias IntermediateCA -keystore "path_to_your_app/res/raw/myKeystore.bks"
-provider org.bouncycastle.jce.provider.BouncyCastleProvider
-providerpath "path_to_bouncycastle/bcprov-jdk16-145.jar" -storetype BKS
-storepass mysecret

下一步点击Enter,没有任何反应

Next clicking Enter and nothing happen

也没有错误消息n其他的东西

Nor message of error neither something else

转到下一行

我做错了什么?

免费询问

编辑

如果我输入不带的命令。\ - 唱歌

if I type command without .\ - sings

就像这样 keytool -importcert -v -trustcac ......... ,所以我收到此错误

like this keytool -importcert -v -trustcac......... , so I get this error

建议[3,一般]:找不到命令keytool,但确实存在于当前位置。默认情况下,Windows PowerShell不会从当前位置加载命令。如果您信任此命令,请键入:。\ keytool。请参阅获取 - 帮助about_Command_Precedence了解更多详情。

Suggestion [3,General]: The command keytool was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\keytool". See "get-help about_Command_Precedence" for more details.






我也试过这样做


also I tried do like this

 PS C:\> C:\Users\alexey.t\Downloads\ElAl_certificates\keytool -importcert -v -trustcacerts .......






这个


and this

PS C:> C:\Users\alexey.t\Downloads\ElAl_certificates\keytool.exe -importcert -v -trustcacerts

没有变化

推荐答案

感谢@Amod Gokhale

Thanks to @Amod Gokhale

所以,最后我将我的证书和BouncyCastle文件移到另一个目录(在我的情况下是C:\ LocalGit \certificate)

So, eventually I moved my certificate and BouncyCastle files to another dir (in my case C:\LocalGit\certificate)

我得到了这个.bks文件没有问题

and I got this .bks file without issues

这篇关于将.cer格式的证书添加到.bks密钥库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 15:31