KeyTool 错误:java.lang.Exception:别名不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42394260/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:07:26  来源:igfitidea点击:

KeyTool error : java.lang.Exception : Alias does not exist

javasslcertificatessl-certificatekeytool

提问by Subodh Joshi

I have sucessfully imported the certificate by below command:

我已通过以下命令成功导入证书:

keytool -import -alias "alias-name" -file 
  "C:\somepath\Certificate\portal.cer 
  -keystore C:\Program Files\Java\jdk1.7.0_79\jre\lib\cacerts"

Now I am trying to delete the imported certificate with

现在我正在尝试删除导入的证书

keytool -delete -alias "alias-name" -keystore 
     "C:\Program Files\Java\jdk1.7.0_79\jre\lib\cacerts" -storepass changeit

But I am end with the below error message:

但我以以下错误消息结束:

KeyTool error : java.lang.Exception : Alias does not exist

KeyTool 错误:java.lang.Exception:别名不存在

回答by Subodh Joshi

Check if the alias exists. You can list all entries using:

检查别名是否存在。您可以使用以下方法列出所有条目:

keytool -list -keystore "C:\Program Files\Java\jdk1.7.0_79\jre\lib\cacerts" -storepass changeit

This command will show all existing aliases in the file. If it's not there, that's why you can't delete it.

此命令将显示文件中的所有现有别名。如果它不存在,这就是您无法删除它的原因。