4

When I verify the signature of my application:

jarsigner -verify -verbose -certs testapp.apk

it gives me the error:

jarsigner: java.lang.SecurityException: invalid SHA1 signature file digest for res/drawable-xhdpi/breadcrumb_grey_white.png

How to resolve this?

Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95
ChanGan
  • 4,254
  • 11
  • 74
  • 135
  • possible duplicate of [invalid SHA1 signature file digest](http://stackoverflow.com/questions/8176166/invalid-sha1-signature-file-digest) – Andrejs Cainikovs Apr 23 '12 at 19:21

2 Answers2

11

make sure to delete the META_INF folder in the apk before signing it. Also, if you are using JDK 7, then include the the option -sigalg MD5withRSA when signing with the jarsigner along with -digestalg SHA1 mentioned by Andrejs

Padmanabha V
  • 430
  • 4
  • 11
  • Caution: if you are trying to sign OSGi bundles remember META_INF/Manifest.mf has some required headers. removing META-INF folder will cause undesirable outcomes. – Govinnage Rasika Perera Mar 09 '15 at 04:52
3

Ripped from here.

Here is the solution:

jarsigner -keystore mykeystore -digestalg SHA1 jarfile alias

To verify:

jarsigner -verify -verbose -certs jarfile
Community
  • 1
  • 1
Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95