Android签名错误:受信任的证书条目不受密码保护

编程入门 行业动态 更新时间:2024-10-10 17:30:40
本文介绍了Android签名错误:受信任的证书条目不受密码保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

获得了证书以对android未签名的发行apk文件进行签名, 因此,我使用以下命令导入了cer:

Got a certificate to sign the android unsigned release apk files, So I imported the cer using command:

keytool -import -alias alias_name -file cer_name.cer -storepass changeit -keystore my_keystore.keystore

但是当用android studio签名应用程序时,会产生错误:

But when signing the app with android studio it produces error:

Error:Execution failed for task ':packageDebug'. > com.android.idemon.signing.KeytoolException: Failed to read key alias_name from store "C:\Users\username\my_keystore.keystore": trusted certificate entries are not password-protected

我的推论说,因为密钥不受密码保护,所以我再次尝试并使用以下命令设置密钥的密码:

My deductions said that because the keys are not password protected so i tried again and set the password for keys using:

keytool -import -alias alias_name -file cer_name.cer -storepass changeit -keypass changeit -keystore my_keystore.keystore

但是错误仍然存​​在.

But still the error persist.

我还尝试了使用jarsigner进行手动操作的过程:

I also tried with manual procedure with jarsigner:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my_keystore.keystore unsigned-release.apk alias_name

出现错误:

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

请帮助我无法获得有关Android APK签名此错误的相关帖子

Please help I am unable to get relevant post on this error for Android apk signings

推荐答案

*.cer文件通常仅包含证书,而不包含对APK进行签名所需的私钥.

*.cer files usually only contain certificates, not the private key needed to sign an APK.

列出密钥库的内容:

keytool -list -v -keystore my_keystore.keystore

,然后查找Entry type:行(用于相应的别名).该值必须是PrivateKeyEntry,而不是trustedCertEntry

And look for the Entry type: line (for the corresponding alias). The value must be PrivateKeyEntry, not trustedCertEntry

更多推荐

Android签名错误:受信任的证书条目不受密码保护

本文发布于:2023-11-24 17:01:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626077.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不受   密码保护   条目   证书   错误

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!