mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
Move trust store to raw resource from asset.
This commit is contained in:
parent
1ac06312a0
commit
26dadfcb7a
4 changed files with 6 additions and 9 deletions
|
@ -24,8 +24,6 @@ import com.google.thoughtcrimegson.Gson;
|
||||||
import com.google.thoughtcrimegson.JsonParseException;
|
import com.google.thoughtcrimegson.JsonParseException;
|
||||||
import com.google.thoughtcrimegson.annotations.SerializedName;
|
import com.google.thoughtcrimegson.annotations.SerializedName;
|
||||||
|
|
||||||
import org.whispersystems.textsecure.util.PhoneNumberFormatter;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -71,13 +69,12 @@ public class NumberFilter {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean containsNumber(String number, String localNumber) {
|
public synchronized boolean containsNumber(String number) {
|
||||||
try {
|
try {
|
||||||
if (bloomFilter == null) return false;
|
if (bloomFilter == null) return false;
|
||||||
else if (number == null || number.length() == 0) return false;
|
else if (number == null || number.length() == 0) return false;
|
||||||
|
|
||||||
return new BloomFilter(bloomFilter, hashCount)
|
return new BloomFilter(bloomFilter, hashCount).contains(number);
|
||||||
.contains(PhoneNumberFormatter.formatNumber(number, localNumber));
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.w("NumberFilter", ioe);
|
Log.w("NumberFilter", ioe);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.thoughtcrimegson.Gson;
|
import com.google.thoughtcrimegson.Gson;
|
||||||
|
import org.whispersystems.textsecure.R;
|
||||||
import org.whispersystems.textsecure.Release;
|
import org.whispersystems.textsecure.Release;
|
||||||
import org.whispersystems.textsecure.directory.DirectoryDescriptor;
|
import org.whispersystems.textsecure.directory.DirectoryDescriptor;
|
||||||
import org.whispersystems.textsecure.directory.NumberFilter;
|
import org.whispersystems.textsecure.directory.NumberFilter;
|
||||||
|
@ -191,8 +192,7 @@ public class PushServiceSocket {
|
||||||
|
|
||||||
private TrustManagerFactory initializeTrustManagerFactory(Context context) {
|
private TrustManagerFactory initializeTrustManagerFactory(Context context) {
|
||||||
try {
|
try {
|
||||||
AssetManager assetManager = context.getAssets();
|
InputStream keyStoreInputStream = context.getResources().openRawResource(R.raw.whisper);
|
||||||
InputStream keyStoreInputStream = assetManager.open("whisper.store");
|
|
||||||
KeyStore trustStore = KeyStore.getInstance("BKS");
|
KeyStore trustStore = KeyStore.getInstance("BKS");
|
||||||
|
|
||||||
trustStore.load(keyStoreInputStream, "whisper".toCharArray());
|
trustStore.load(keyStoreInputStream, "whisper".toCharArray());
|
||||||
|
|
|
@ -15,8 +15,8 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.google.android.gcm.GCMRegistrar;
|
import com.google.android.gcm.GCMRegistrar;
|
||||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||||
import org.whispersystems.textsecure.push.GcmIntentService;
|
import org.thoughtcrime.securesms.gcm.GcmIntentService;
|
||||||
import org.whispersystems.textsecure.push.GcmRegistrationTimeoutException;
|
import org.thoughtcrime.securesms.gcm.GcmRegistrationTimeoutException;
|
||||||
import org.whispersystems.textsecure.push.PushServiceSocket;
|
import org.whispersystems.textsecure.push.PushServiceSocket;
|
||||||
import org.whispersystems.textsecure.push.RateLimitException;
|
import org.whispersystems.textsecure.push.RateLimitException;
|
||||||
import org.whispersystems.textsecure.util.Util;
|
import org.whispersystems.textsecure.util.Util;
|
||||||
|
|
Loading…
Reference in a new issue