What is the difference between the Java 1.6 and 1.7 jarsigner
Asked Answered
P

2

16

Just noted that you can´t sign Android APKs with the Java 1.7 jarsigner. So I wonder why this is and what is the difference between the 1.6 and 1.7 signer?

Poly answered 5/1, 2012 at 8:27 Comment(0)
T
11

This is because the default digest algorithm for Java 1.7 is SHA-256 while for Java 1.6 it's SHA1withDSA.

Java 1.6 Jarsigner docs

Java 1.7 Jarsigner docs

Trent answered 5/1, 2012 at 8:37 Comment(1)
Thanks. Now I just have to find out how to tweak maven to use the right jarsigner and / or the correct sigalg.Poly
C
6

Yes you CAN use 1.7!

It is very tricky to find info on the usage with 1.7, but once found it is reasonable simple:

For keytool include

-sigalg SHA1withDSA -keyalg DSA -keysize 1024

For jarsigner include

-sigalg SHA1withDSA -digestalg SHA1

(1024 is the maximum and works, less might do the trick)

Chatterjee answered 22/1, 2012 at 22:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.