Java 在密钥库文件中查找别名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28105134/
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
Find the alias name in the keystore file
提问by user903676
I have a key store file cacerts under jre/lib/security in which i added a Certicate by using the import command.
我在 jre/lib/security 下有一个密钥存储文件 cacerts,我在其中使用导入命令添加了一个证书。
There are more than 50 certificates in my keystore. How do i find the alias name of the last imported certificate in the keystore. I want to delete the last added certificate for which i need the alias name. Kindly help.
我的密钥库中有 50 多个证书。如何在密钥库中找到最后导入的证书的别名。我想删除最后添加的需要别名的证书。请帮忙。
回答by SubOptimal
You can list all certificates in the keystore like
您可以列出密钥库中的所有证书,例如
on Linux
在 Linux 上
keytool -list -v -keystore keystore.jks | grep "Alias name\|Creation date"
on Windows
在 Windows 上
keytool -list -v -keystore keystore.jks | findstr "Alias Creation"
回答by zatenzu
回答by yohanfernando
Have you tried listing all certificates.
您是否尝试过列出所有证书。
keytool -list -v -keystore keys.store
keytool -list -v -keystore keys.store
It may be in the order they were added.
可能是按照添加顺序。
Also if you added the certificate via command prompt or terminal check history.
此外,如果您通过命令提示符或终端检查历史记录添加了证书。