简体   繁体   English

从私钥和证书重新创建密钥库文件

[英]Recreate keystore file from private key and certificate

I am trying to sign an Android app but apparently the original keystore file is not available. 我正在尝试签署一个Android应用程序,但显然原始密钥库文件不可用。 All I have been given is the following: 我得到的只是以下内容:

  1. Private key md5 0123456789abcdef0123456789abcdef <-- fictitious values but the 私钥md5 0123456789abcdef0123456789abcdef <-虚拟值,但
  2. Certificate md5 fedcba9876543210fedcba9876543210 <-- original are 32 hex digits 证书md5 fedcba9876543210fedcba9876543210 <-原始为32位十六进制数字
  3. The signed production Android app 已签名的量产版Android应用

Is there any way to recreate a keystore file from these assets so that I can use the usual Android build process, (eg jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name) to sign updated builds of the Android app in the same way as the original app? 有什么办法可以从这些资产重新创建密钥库文件,以便我可以使用通常的Android构建过程(例如jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name)进行签名是否以与原始应用相同的方式更新了Android应用的版本?

Alternatively can I sign the app in a different way using these values whilst maintaining consistency with the original app? 另外,我可以使用这些值以其他方式对应用程序进行签名,同时保持与原始应用程序的一致性吗?

No, you cannot. 你不能。 Once the private key is lost there is no way to recreate it. 一旦私钥丢失,就无法重新创建它。 If that would be possible the private key would not have much value. 如果那是可能的话,私钥将没有太大价值。 MD5 is a one way function, it cannot be reverted and - if the input is large enough, such as a private key - it cannot be brute forced either. MD5是一种单向功能,无法还原,并且-如果输入足够大(例如私钥),则也不能强制执行。 The MD5 values over the key and certificate are only used to identify the key and certificate (called fingerprinting as the values are tied to the value of key and certificate). 密钥和证书上的MD5值仅用于标识密钥和证书(称为指纹,因为这些值与密钥和证书的值相关联)。

All you can do is to create a new key pair + certificate (signed by the same CA certificate) and use that to sign the app. 您所要做的就是创建一个新的密钥对+证书(由相同的CA证书签名),并使用它来对应用程序进行签名。

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

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