Okay, toss BouncyCastleProvider so we can release a beta.

This commit is contained in:
Vavassor 2017-07-18 00:30:24 -04:00
parent 857f39b480
commit bb0ea876fa
3 changed files with 9 additions and 55 deletions

View file

@ -7,8 +7,8 @@ android {
applicationId "com.keylesspalace.tusky"
minSdkVersion 15
targetSdkVersion 25
versionCode 22
versionName "1.1.4-beta.6"
versionCode 23
versionName "1.1.4-beta.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}
@ -57,7 +57,6 @@ dependencies {
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.1.1') {
exclude module: 'support-v4'
}
compile 'org.bouncycastle:bcprov-jdk15on:1.57'
testCompile 'junit:junit:4.12'
//room
compile 'android.arch.persistence.room:runtime:1.0.0-alpha3'

View file

@ -45,19 +45,15 @@
-keepattributes SourceFile,LineNumberTable
# remove all logging from production apk
-assumenosideeffects class android.util.Log {
public static *** getStackTraceString(...);
public static *** d(...);
public static *** w(...);
public static *** v(...);
public static *** i(...);
}
#-assumenosideeffects class android.util.Log {
# public static *** getStackTraceString(...);
# public static *** d(...);
# public static *** w(...);
# public static *** v(...);
# public static *** i(...);
#}
# for jsoup
-keep public class org.jsoup.** {
public *;
}
# for bouncycastle
-keep class org.bouncycastle.**
-dontwarn javax.naming.**

View file

@ -18,20 +18,13 @@ package com.keylesspalace.tusky;
import android.app.Application;
import android.arch.persistence.room.Room;
import android.net.Uri;
import android.util.Log;
import com.jakewharton.picasso.OkHttp3Downloader;
import com.keylesspalace.tusky.db.AppDatabase;
import com.keylesspalace.tusky.util.OkHttpUtils;
import com.squareup.picasso.Picasso;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.security.Provider;
import java.security.Security;
public class TuskyApplication extends Application {
private static final String TAG = "TuskyApplication"; // logging tag
private static AppDatabase db;
public static AppDatabase getDB() {
@ -59,40 +52,6 @@ public class TuskyApplication extends Application {
throw new RuntimeException(e);
}
/* Install the new provider or, if there's a pre-existing older version, replace the
* existing version of it. */
final String providerName = "BC";
Provider existingProvider = Security.getProvider(providerName);
if (existingProvider == null) {
try {
int priority = Security.addProvider(new BouncyCastleProvider());
Log.i(TAG, String.format("BouncyCastleProvider was added with priority %d.",
priority));
} catch (SecurityException e) {
Log.e(TAG, "Permission to add the security provider was denied.");
}
} else {
Provider replacement = new BouncyCastleProvider();
if (existingProvider.getVersion() < replacement.getVersion()) {
Provider[] providers = Security.getProviders();
int priority = 1;
for (int i = 0; i < providers.length; i++) {
if (providers[i].getName().equals(providerName)) {
priority = i + 1;
}
}
try {
Security.removeProvider(providerName);
Security.insertProviderAt(replacement, priority);
Log.i(TAG, String.format(
"BouncyCastleProvider version %f was updated to version %f.",
existingProvider.getVersion(), replacement.getVersion()));
} catch (SecurityException e) {
Log.e(TAG, "Permission to update a security provider was denied.");
}
}
}
db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "tuskyDB")
.allowMainThreadQueries()
.build();