java keystore和apk签名

1.转换pk8到java keystore:

1.1 命令行制定密码,默认密码为android

把platform.pk8转换成java keystore

openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.pem
openssl pkcs12 -export -in platform.x509.pem -out platform.p12 \
    -inkey  platform.pem -password pass:android -name androiddebugkey
keytool -importkeystore -deststorepass android -destkeystore \
    ./platform.jks -srckeystore ./platform.p12 \
    -srcstoretype PKCS12 -srcstorepass android

1.2 提示输入密码

把platform.pk8转换成java keystore

openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.pem

alias为platform,提示输入密码

openssl pkcs12 -export -in platform.x509.pem -out platform.p12 
    -inkey  platform.pem -name platform

提示输入密码

keytool -importkeystore -destkeystore ./platform.jks \
    -srckeystore ./platform.p12 -srcstoretype PKCS12

###其他常用指令

手动生成java keystore:

keytool  -genkeypair -keystore me.jks -alias me.jks

查看keystore内容

keytool -list -v -keystore me.jks

给jar签名

jarsigner -keystore me.jks -signedjar <new.jar> <old.jar> me.jks