简体   繁体   English

使用 .p12 签署 apk

[英]Signing apk with .p12

I am going to update my client's app which is available on Google PlayStore.我将更新我的客户的应用程序,该应用程序在 Google PlayStore 上可用。 And I have only a .p12 file with password, not .keystore file.而且我只有一个带密码的.p12文件,而不是.keystore文件。

I am wondering if it's possible to publish the updated version to Google PlayStore.我想知道是否可以将更新版本发布到 Google PlayStore。

Sorry for basic question.对不起,基本问题。 I am so confused with that.我很困惑。 Thank you in advance for your assistance.预先感谢您的帮助。

You can just convert your p12 file to jks:您可以将 p12 文件转换为 jks:

Create an empty JKS store创建一个空的 JKS 存储

keytool -genkey -alias anyname -keystore yourcertificate.jks
keytool -delete -alias anyname -keystore yourcertificate.jks

Import yourcertificate.p12 into yourcertificate.jks将 yourcertificate.p12 导入到 yourcertificate.jks

keytool -v -importkeystore -srckeystore yourcertificate.p12 -srcstoretype PKCS12 -destkeystore yourcertificate.jks -deststoretype JKS

You can also check this link: http://shib.kuleuven.be/docs/ssl_commands.shtml#keytool您还可以查看此链接: http : //shib.kuleuven.be/docs/ssl_commands.shtml#keytool

这些命令对我有用:

keytool -importkeystore -srckeystore yourp12file.p12 -destkeystore keystorefile.keystore -srcstoretype pkcs12

You gonna use the flag -storetype PKCS12您将使用标志-storetype PKCS12

First, create your keystore with its alias [ on this ex.首先,使用别名[ 在此 ex 上创建您的密钥库 mykeystore and myalias ] mykeystoremyalias ]

keytool -genkey -alias myalias -keystore mykeystore -storetype PKCS12 -keyalg RSA -validity 3650 -keysize 2048

And just sign your APK只需签署您的 APK

jarsigner -keystore mykeystore my.apk myalias

In case you need to align the app, use zipalign command before and do the signing with the aligned one, like so:如果您需要对齐应用程序,在之前使用zipalign 命令并使用对齐的进行签名,如下所示:

zipalign -f -p 4 my.apk myapk-aligned.apk

jarsigner -keystore mykeystore my-aligned.apk myalias

Flags used on zipalign zipalign 上使用的标志

-f overwrite existing outfile -f覆盖现有的输出文件

-p page align stored shared object files -p页面对齐存储的共享对象文件

-v if you want to see the verbose log, use that -v如果您想查看详细日志,请使用它


The -validity 3650 was used to expire the signing in 10 years -validity 3650用于使签名在 10 年内到期

No, you can't use .p12 file to uplaod app to Google PlayStore.不,您不能使用 .p12 文件将应用上传到 Google PlayStore。 You need .keystore file.您需要 .keystore 文件。

A P12 file (a file with a .p12 extension) is a type of certificate file (a Personal Information Exchange file). P12 文件(扩展名为 .p12 的文件)是一种证书文件(个人信息交换文件)。 The Packager for iPhone uses this type of certificate to build an iPhone application. Packager for iPhone 使用这种类型的证书来构建 iPhone 应用程序。 You convert the developer certificate you receive from Apple into this form of certificate.您将从 Apple 收到的开发者证书转换为这种形式的证书。 So, a .p12 file is for iOS development.因此,.p12 文件用于 iOS 开发。

On the other hand, you could try doing a system restore, on your computer, to a previous date in which you haven't misplaced or deleted your key yet.另一方面,您可以尝试在您的计算机上将系统还原到您尚未放错或删除密钥的前一个日期。

Also you can view:您还可以查看:

  1. Android Keystore File Lost Android 密钥库文件丢失

  2. Lost my keystore for uploaded app on android market 丢失了我在 android 市场上上传的应用程序的密钥库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM