Android签名错误:受信任的证书条目不受密码保护 [英] Android signing error: trusted certificate entries are not password-protected
问题描述
获得了证书以对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.ide.common.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签名错误:受信任的证书条目不受密码保护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!