How to convert .pfx file to keystore with private key?

后端 未结 6 1200
情话喂你
情话喂你 2020-11-27 09:22

I need to sign Android application (.apk).
I have .pfx file. I converted it to .cer file via Internet Explorer and then converted

6条回答
  •  醉酒成梦
    2020-11-27 09:48

    jarsigner can use your pfx file as the keystore for signing your jar. Be sure that your pfx file has the private key and the cert chain when you export it. There is no need to convert to other formats. The trick is to obtain the Alias of your pfx file:

     keytool -list -storetype pkcs12 -keystore your_pfx_file -v | grep Alias
    

    Once you have your alias, signing is easy

    jarsigner.exe -storetype pkcs12 -keystore pfx_file jar_file "your alias"
    

    The above two commands will prompt you for the password you specified at pfx export. If you want to have your password hang out in clear text use the -storepass switch before the -keystore switch

    Once signed, admire your work:

    jarsigner.exe -verify -verbose -certs  yourjarfile
    

提交回复
热议问题