keytool - 当别名包含异常字符(?)时,从信任库中删除证书

标签 keytool

使用命令行中的 keytool,我向商店添加了一个新证书。但是我发现自己目前使用的令人愤怒的窗口管理器在剪切和粘贴方面失败了,并用 ? 替换了别名的一个字符。特点。如何更改或删除该别名?

keytool -list -keystore truststore
Enter keystore password:  

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 4 entries

hail.ucc.nau.edu:8636-cert-1?, Dec 1, 2017, trustedCertEntry,

......

keytool -delete -keystore truststore -alias 'hail.ucc.nau.edu:8636-cert-1?'
Enter keystore password:  
keytool error: java.lang.Exception: Alias <hail.ucc.nau.edu:8636-cert-1?> does not exist

......

keytool -delete -keystore truststore -alias 'hail.ucc.nau.edu:8636-cert-1\?'
Enter keystore password:  
keytool error: java.lang.Exception: Alias <hail.ucc.nau.edu:8636-cert-1\?> does not exist

......

keytool -delete -keystore truststore -alias 'hail.ucc.nau.edu:8636-cert-1'
Enter keystore password:  
keytool error: java.lang.Exception: Alias <hail.ucc.nau.edu:8636-cert-1> does not exist

感谢您的帮助,

 - rob.

最佳答案

您看到的特殊字符可能不是@Pavel Lechev 在评论中建议的实际字符。如果keytool删除不起作用,您可以使用KeyStore Explorer软件来做到这一点。它有漂亮的 GUI,提供所有 keytool 功能。

或者您可以使用 KeyStore api 编写一个小工具/类来删除不需要的别名。您可以列出所有别名,识别它并删除它(要识别别名,您可以执行 startsWith())。

关于keytool - 当别名包含异常字符(?)时,从信任库中删除证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47602504/

相关文章:

java - 如何生成MD5指纹

java - Glassfish 和 Verisign 试用测试证书

java keystore 和密码更改

java.Security.NoSuchAlgorithmException

java - Cacerts 与 Java 版本的兼容性

java - 如何使用 keytool 查看证书 key 大小?

java - 使用 Java keytool 的 PKCS11 格式 key

java - 为什么 keytool 会报告 'NoSuchAlgorithmException; cannot support algorithm "RSA"'?

Java SSL 问题 - 无法解析的 CRLDistributionPoints 扩展

android - 创建 keystore 文件时遇到问题