将.keystore转换为.jks以签署apk

时间:2018-04-19 15:13:47

标签: android xamarin xamarin.android keystore jks

我有一个Android应用程序,我试图使用quixxi.com保护,但它需要我再次签署该应用程序。但要做到这一点,它必须使用.jks文件,但我的密钥库是.keystore

我在C#中使用Xamarin.Android和Visual Studio 2017

有什么方法吗?

1 个答案:

答案 0 :(得分:5)

如果您使用Java keystone签署您的Android应用程序(不论是否基于Xamarin),则用于签署XXX.keystore个应用程序的Xamarin.Android赔率为99.999% 已经是JKS格式,而不是PKCS12格式。

快速检查方法是以RFC格式转储keystone并查看Keystore type:字段。

实施例

/usr/bin/keytool -list -rfc -keystore debug.keystore |grep "Keystore type"

输出:

Enter keystore password:

*****************  WARNING WARNING WARNING  *****************
* The integrity of the information stored in your keystore  *
* has NOT been verified!  In order to verify its integrity, *
* you must provide your keystore password.                  *
*****************  WARNING WARNING WARNING  *****************

Keystore type: JKS

Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore debug.keystore -destkeystore debug.keystore -deststoretype pkcs12".

示例(未过滤):

/usr/bin/keytool -list -rfc -keystore sushi.keystore 

输出:

Enter keystore password:

*****************  WARNING WARNING WARNING  *****************
* The integrity of the information stored in your keystore  *
* has NOT been verified!  In order to verify its integrity, *
* you must provide your keystore password.                  *
*****************  WARNING WARNING WARNING  *****************

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: androiddebugkey
Creation date: Aug 20, 2017
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
-----BEGIN CERTIFICATE-----
MIIDDTCCAfWgAwIBAgIEeCTY/jANBgkqhkiG9w0BAQsFADA3MQswCQYDVQQGEwJV
~~~~
KvHIbSHVBsryiyCwPJkXP6A=
-----END CERTIFICATE-----


*******************************************
*******************************************

如果您确实需要将PKCS12类型存储转换为新的JKS密钥库类型文件:

keytool -importkeystore -srckeystore somekeystore.pkcs12 -destkeystore somenewkeystore.jks -deststoretype jks