找不到证书链,但密钥库包含私钥 [英] Certificate chain not found, but keystore contains private key

查看:1547
本文介绍了找不到证书链,但密钥库包含私钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想签署我的apk,所以我可以使用这个命令更新我的应用程序: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myrelease-key.keystore CordovaAppreleaseunsigned.apk alias_name 但出现此错误:

  jarsigner:找不到证书链: sigalg必须引用包含私钥和相应的公钥证书链的有效KeyStore密钥条目。 

我刚刚移动到一台新电脑,所以我复制我的.keystore文件。当我做 keytool -list -v 它似乎它包含私钥,所以我不明白什么错误..公钥丢失?

解决方案

显然这是一个编码问题。该命令包含看起来类似于减号(ASCII代码0x2D)的字符,但实际上是许多短划线或连字符字符之一( http://en.wikipedia.org/wiki/Dash )。



由于错误的字符代码,第一个参数 -verbose 被jarsigner识别为不是一个选项,而是作为jar文件的名称,并且 -sigalg 被识别作为别名:

 用法:jarsigner [options] jar-file别名
/ pre>

这解释了为什么错误消息中的别名是sigalg ,而不是实际的别名命令,并在开头包含反转感叹号(这在以前是另一个字符集中的 - )。


Im trying to sign my apk so I can release an update to my app with this command: jarsigner ­-verbose -sigalg SHA1withRSA -­digestalg SHA1 ­-keystore my­release-key.keystore CordovaApp­release­unsigned.apk alias_name but getting this error:

jarsigner: Certificate chain not found for: ¡sigalg.  ¡sigalg must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

I´ve just moved to a new computer so I copied my .keystore file to it. When I do keytool -list -v it seems like it contains the private key, so I dont understand whats wrong.. Is the public key missing?

解决方案

Obviously it was an encoding issue. The command contained characters that looked similar to a minus sign (ASCII code 0x2D), but actually were one of the many dash or hyphen characters (http://en.wikipedia.org/wiki/Dash).

Because of the wrong character code the first parameter "-verbose" was recognised by jarsigner not as an option but as the name of the jar file and "-sigalg" was recognised as the alias:

Usage: jarsigner [options] jar-file alias

This explains why the alias in the error message was "¡sigalg" and not the actual alias from the command and contained an inverted exclamation mark at the beginning (this used to be the "-" in another character set).

这篇关于找不到证书链,但密钥库包含私钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆