Venugopal
Venugopal

Reputation: 1298

Is it possible to sign APK by copying signature files inside META-INF folder of signed APK

I am not sure whether my approach is valid or not but am trying to sign my APK by copying signature files of already signed APK as I don't have valid keystore to sign my APK.

I believe signature of signed APK lies inside META-INF folder. I can retrieve it by unzipping APK file. It did not work when I copy META-INF folder to unsigned APK by using 'apktool'. I am getting Invalid APK error while installation and JarSigner is telling 'no manifest' and 'jar is unsigned'.

Please correct me if there is anything wrong or suggest a better approach.

Upvotes: 0

Views: 3074

Answers (2)

le_top
le_top

Reputation: 493

You can not do this unless the APK content is already the same (in which case it is not usefull).

The signature in the original APK validates that the "files" in that APK have a certain "checksum" (MD5 and/or SHA1). The "checksum" in your new APK is different, so the signature does not correspond to that "checksum" and it would be invalid.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007614

Is it possible to sign APK by copying signature files inside META-INF folder of signed APK

No. That is not how digital signatures work. A signature is calculated based on the content of the file being signed, as well as the signing key.

Upvotes: 1

Related Questions