安卓sdk制作keystore

android生成sdk的keystore

步骤

  1. 编译sdk,注意user与userdebug编译出来的密钥与keystore是不相同的
    编译后生成的密钥目录分别对应如下,或可使用find命令搜索
    ./vendor/sprd/platform/packages/apps/Messaging/signature/release/platform.pk8
    ./vendor/sprd/platform/packages/apps/Messaging/signature/debug/platform.pk8
    ./vendor/sprd/platform/packages/apps/Messaging/signature/release/platform.x509.pem
    ./vendor/sprd/platform/packages/apps/Messaging/signature/debug/platform.x509.pem
  2. user版本则在relese目录,userdebug在debug目录下,把这个platform.pk8与platform.x509.pem拷贝出来
  3. 使用openssl及keytool命令生成keystore文件
openssl pkcs8 -in ./platform.pk8 -inform DER -outform PEM -out platform.priv.pem -nocrypt

openssl pkcs12 -export -in platform.x509.pem -inkey platform.priv.pem -out platform.pk12 -name r2

keytool -importkeystore -deststorepass123 -destkeypass 123 -destkeystore test.keystore -srckeystore platform.pk12 -srcstoretype PKCS12 -deststoretype JKS -srcstorepass 123 -alias r2

问题:

keytool如果参数或版本不对,可能会有这个警告:
Warning:
使用的 SHA1withRSA 签名算法被视为存在安全风险。此算法将在未来的更新中被禁用。

然后用这个生成的keystore,编译,编译会出错。
Failed to read key r2 from store “/opt/android/project/R2-Dict/r2_release.keystore”: Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available

解决

方法是keytool加参数 -deststoretype JKS

作者:帅得不敢出门

你可能感兴趣的:(Android平台,android,sdk,keystore)