GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-02-05T00:11:02.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | 2014 Sprint 03, 2014 Sprint 03 Core, Release 3.2.3, Release 3.3.0 |
Components | CLI |
Labels | qe-3.2.0, qe-3.2.0-GA2, qe-closed-3.2.3, qe-testadded |
Reporter | Wilson Luu |
Assignee | Chris Barber |
Created | 2014-01-17T00:31:22.000+0000 |
Updated | 2015-01-26T09:47:54.000+0000 |
If you try to package an app (from CLI) to a non-KitKat device, then the CLI should throw a warning if you signed the packaged app with a SHA256withRSA signature algorithm keystore. And, indicate to the user to use a SHA1withRSA signature keystore for a non-KitKat device.
Java 1.6.X only ships with SHA1withRSA.
Java 1.7.X ships with both SHA1withRSA and SHA256withRSA.
Master pull request: https://github.com/appcelerator/titanium_mobile/pull/5296 3.2.x pull request: https://github.com/appcelerator/titanium_mobile/pull/5297 To test: 1. create an android project 2. download the keystore attachment on this ticket 3. build the app for android using this keystore:
ti build -p android -T dist-playstore
4. when prompted, specify the path to the keystore 5. enter the password "123123" 6. select the alias "foo" 7. you should see a warning Next we test when specifying from the command line:Try a bad alias:
Try building for an Android device running Android 4.3 or OLDER:
Verified the fixed with test environment: Appc Studio:3.2.3.201403250634 Sdk:3.2.3.v20140325145222 alloy:1.3.1 titanium:3.2.3-dev titanium-code-processor:1.1.0 Osx: Windows 8.1,Ubuntu 12.0.4 Device:LG-P970(V4.0.4) Followed the above mentioned test steps and got the expected Result. Hence Closing the issue as fixed.
Hi. Can we specify signing algorithm in CLI? If not, why that wasn't implemented? :)
[~ivan.skugor] Nope. It wasn't implemented because we detect and use the actual signature type that the selected cert in the keystore uses. There's no point specifying it.
Thanks for answer. I actually have a need to specify signing algorithm. We have one app that we brand for different clients and we use different keystores for each brand. We were unlucky to publish app with keystore that has SHA256 as default signing algorithm (and as far as I know, there's no way to update keystore). I've updated app by manually signing, but it would be handy if I could specify signing algorithm. And I'm not the only one with similar problem: http://www.tidev.io/2013/12/31/gotcha-package-file-was-not-signed-correctly/ Also, IMO it would be more future-proof if algorithm could be specified.
The default signature algorithm is "MD5withRSA". However, this is overwritten by the actual signature found in the keystore for the given alias. Run this:
Titanium will scan the output and finds the entry for the specified
\-\-alias
and then parses out the "Signature algorithm name". So why is it not finding the correct signature algorithm? Is the\-\-alias
correct? Is the text rendered by keytool not matching?Yes, Titanium finds signature algorithm correctly (SHA256withRSA), but that algorithm has issue with pre-4.4 Android devices (apk can't be installed). When I manually set signature algorithm to SHA1withRSA, it works fine.
How is that possible? Are you manually calling jarsigner? How is that different than what the Android build is currently doing? https://github.com/appcelerator/titanium_mobile/blob/master/android/cli/commands/_build.js#L4095-L4136
Yes, I manually call jarsigner (and after that, zipalign), I changed "sigalg" parameter: "-sigalg" "SHA1withRSA" (so, that part is different from what Titanium does). Sorry for confusion.
Oooooooooh. OK, let me escalate and chat with the guys tomorrow. Sit tight. :)
Thanks! :)
@Ivan: I had the same problem, so I just change the build script Chris posted before so it won't do: var sigalg = this.keystoreAlias.sigalg || 'MD5withRSA', but only: var sigalg = 'MD5withRSA', Then I was sure that I never used the SHA256 and I didn't need to run the scripts manually. But it would be nice to specify the sigalg because I have a new key too and need to compile for old phones and it will always select the 256 by default
Michael G, yeah, that could be workaround, but I would still like to have this solved in SDK if possible. :)
[~ivan.skugor] What version of Java are you using? We talked and we think that if you switch to Java 1.7, things should work.
I already use 1.7, but it doesn't work with it.
[~ivan.skugor] OK, cool. Ticket created! TIMOB-18441
Awesome, thank you. :)