Move trust store to raw resource from asset.

This commit is contained in:
Moxie Marlinspike 2013-07-10 16:33:14 -07:00
parent 1ac06312a0
commit 26dadfcb7a
4 changed files with 6 additions and 9 deletions

View file

@ -24,8 +24,6 @@ import com.google.thoughtcrimegson.Gson;
import com.google.thoughtcrimegson.JsonParseException;
import com.google.thoughtcrimegson.annotations.SerializedName;
import org.whispersystems.textsecure.util.PhoneNumberFormatter;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@ -71,13 +69,12 @@ public class NumberFilter {
this.version = version;
}
public synchronized boolean containsNumber(String number, String localNumber) {
public synchronized boolean containsNumber(String number) {
try {
if (bloomFilter == null) return false;
else if (number == null || number.length() == 0) return false;
return new BloomFilter(bloomFilter, hashCount)
.contains(PhoneNumberFormatter.formatNumber(number, localNumber));
return new BloomFilter(bloomFilter, hashCount).contains(number);
} catch (IOException ioe) {
Log.w("NumberFilter", ioe);
return false;

View file

@ -6,6 +6,7 @@ import android.util.Base64;
import android.util.Log;
import com.google.thoughtcrimegson.Gson;
import org.whispersystems.textsecure.R;
import org.whispersystems.textsecure.Release;
import org.whispersystems.textsecure.directory.DirectoryDescriptor;
import org.whispersystems.textsecure.directory.NumberFilter;
@ -191,8 +192,7 @@ public class PushServiceSocket {
private TrustManagerFactory initializeTrustManagerFactory(Context context) {
try {
AssetManager assetManager = context.getAssets();
InputStream keyStoreInputStream = assetManager.open("whisper.store");
InputStream keyStoreInputStream = context.getResources().openRawResource(R.raw.whisper);
KeyStore trustStore = KeyStore.getInstance("BKS");
trustStore.load(keyStoreInputStream, "whisper".toCharArray());

View file

@ -15,8 +15,8 @@ import android.util.Log;
import com.google.android.gcm.GCMRegistrar;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.whispersystems.textsecure.push.GcmIntentService;
import org.whispersystems.textsecure.push.GcmRegistrationTimeoutException;
import org.thoughtcrime.securesms.gcm.GcmIntentService;
import org.thoughtcrime.securesms.gcm.GcmRegistrationTimeoutException;
import org.whispersystems.textsecure.push.PushServiceSocket;
import org.whispersystems.textsecure.push.RateLimitException;
import org.whispersystems.textsecure.util.Util;