秘钥生成工具——keytool
路径:jdk/bin/keytool.exe
生成秘钥:keytool -genkeypair -keystore test.keystore -alias test -validity 10 -keyalg RSA
其中-validity指定有效期天数,-keyalg指定算法
查看秘钥信息:keytool -list -v -keystore test.keystore
JDK签名工具——jarsigner
仅支持V1签名
路径:jdk/bin/jarsigner.exe
命令:jarsigner -keystore test.keystore test.apk testkey
apk签名工具——apksigner
默认开启V1和V2签名
路径:AndroidSDK/build-tools/28.0.0/apksigner.bat
命令:apksigner sign --ks xx.keystore --ks-key-alias testkey test.apk
警告:
使用jarsigner -keystore test.keystore test.apk testkey报警告
问题:
1:不应该在C盘创造keystore,没有权限,改到D盘正常。
keytool -genkeypair -keystore F:\xxx.keystore -alias xxx-validity 36500 -keyalg RSA