Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Revert "Not storing salt into database anymore for increased privacy"
Browse files Browse the repository at this point in the history
This reverts commit 89f3a23.

Conflicts:
	CHANGELOG.md

Closes #1664
Refs #1661
  • Loading branch information
M66B committed May 17, 2014
1 parent f67d14b commit bd21f76
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Changelog

**Next release**

* Reverted "Not storing salt into database anymore for increased privacy" ([issue](/../../issues/1661)) ([issue](/../../issues/1664))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

**Version 2.0.23 BETA**
Expand Down
8 changes: 6 additions & 2 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ protected void onCreate(Bundle savedInstanceState) {

// Salt should be the same when exporting/importing
String salt = PrivacyManager.getSetting(userId, PrivacyManager.cSettingSalt, null, false);
if (salt != null && salt.equals(Build.SERIAL))
PrivacyManager.setSetting(userId, PrivacyManager.cSettingSalt, null);
if (salt == null) {
salt = Build.SERIAL;
if (salt == null)
salt = "";
PrivacyManager.setSetting(userId, PrivacyManager.cSettingSalt, salt);
}

// Import license file
if (getIntent().getAction().equals(Intent.ACTION_VIEW))
Expand Down
4 changes: 2 additions & 2 deletions src/biz/bokhorst/xprivacy/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ private static boolean verifyData(byte[] data, byte[] signature, PublicKey publi
public static String sha1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
// SHA1
int userId = Util.getUserId(Process.myUid());
String salt = PrivacyManager.getSetting(userId, PrivacyManager.cSettingSalt, Build.SERIAL, true);
String salt = PrivacyManager.getSetting(userId, PrivacyManager.cSettingSalt, "", true);
MessageDigest digest = MessageDigest.getInstance("SHA-1");
byte[] bytes = (text + salt).getBytes("UTF-8");
digest.update(bytes, 0, bytes.length);
Expand All @@ -448,7 +448,7 @@ public static String sha1(String text) throws NoSuchAlgorithmException, Unsuppor
public static String md5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
// MD5
int userId = Util.getUserId(Process.myUid());
String salt = PrivacyManager.getSetting(userId, PrivacyManager.cSettingSalt, Build.SERIAL, true);
String salt = PrivacyManager.getSetting(userId, PrivacyManager.cSettingSalt, "", true);
byte[] bytes = MessageDigest.getInstance("MD5").digest((text + salt).getBytes("UTF-8"));
StringBuilder sb = new StringBuilder();
for (byte b : bytes)
Expand Down

0 comments on commit bd21f76

Please sign in to comment.