keytool找不到别名 [英] keytool can't find alias
问题描述
我有一个pfx证书,需要通过别名引用.问题是即使keytool显示在列表中,keytool也无法找到该别名.
I've got a pfx certificate that I need to reference by alias. The problem is that keytool can't find that alias, even though it shows on the list.
keytool -list -keystore temp.pfx -storetype pkcs12
给我这个:
...
0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c, 08/03/2013, PrivateKeyEntry,
...
但是每当我尝试使用keytool对该别名进行任何操作(即导出,重命名)时,都会给我一个错误:
But whenever I try to use keytool to do anything with that alias (i.e., export, rename), it gives me an error:
keytool error: java.lang.Exception: Alias <0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c> does not exist
有什么想法吗?
推荐答案
事实证明,在检查vim上keytool -list
的输出后,我在别名末尾发现了一个空字符(该字符未打印出来)到控制台).一旦将它添加到引用别名的命令中,它就会起作用:
It turns out that after inspecting the output of keytool -list
on vim, I found a null character at the end of the alias (which doesn't get printed to the console). Once I added that to the command that references an alias, it worked:
keytool -keyclone -changealias -v -dest "new_alias" -new newpass -keystore temp.pfx -storetype pkcs12 -alias 0c5fc7cef279ca390acd2d6bac9ffcf8_ba0cbbb3-323d-4394-8e76-47838adb2a9c$'\x00'
真正重要的是结尾:$'\x00'
表示bash中的空字符.请记住,这是非常依赖于shell的.
Where the very end is what really matters: $'\x00'
stands for null character in bash. Keep in mind that this is pretty shell-dependent.
这篇关于keytool找不到别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!