android studio签名

1. 通过 .pk8 和 .x509.pem 文件生成 keystore 文件,bat脚本

set in_pk8="F:\chNet\sign_hisi\tools\platform.pk8"
set in_x509_pem="F:\chNet\sign_hisi\tools\platform.x509.pem"

set out_name=out.keystore
set out_alias="hisi"
set out_password=12345678

set openssl="D:\Program Files\Git\usr\bin\openssl.exe"
set keytool="C:\Program Files\Java\jre1.8.0_191\bin\keytool.exe"

::使用 open ssl 将pk8 解密为 pem 文件, 此时生成一个testkey.pem 文件
%openssl% pkcs8 -inform DER -nocrypt -in %in_pk8% -out testkey.pem

::将两个pem 文件导入platform.p12文件中,
::并设置 别名 testkey 和keypass 密码:12345678 (别名和密码可自定义)会新生成 platform.p12
%openssl% pkcs12 -export -in %in_x509_pem% -inkey testkey.pem -out platform.p12 -password pass:%out_password% -name %out_alias%

::使用keytool 将之前生成的platform.p12导入 testkey.jks 签名中,并设置storepass密码(12345678)
::需要正确提供keypass 密码
::此时即生成了需要的testkey.jks 签名文件
%keytool% -importkeystore -deststorepass 12345678 -destkeystore %out_name% -srckeystore platform.p12 -srcstoretype PKCS12 -srcstorepass %out_password%

::查看生成的 签名信息
%keytool% -list -v -keystore %out_name%
pause

  

2. android studio 配置

File-->Project Structure-->app-->signing

遇到一个问题:Name输入为config后,不能正确工作

猜你喜欢

转载自www.cnblogs.com/liuyj-vv/p/10246061.html