Merge branch 'master' of github.com:open-keychain/open-keychain

This commit is contained in:
Vincent Breitmoser
2015-09-06 00:59:12 +02:00
22 changed files with 52 additions and 54 deletions

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -71,7 +71,7 @@
android:name=".KeychainApplication" android:name=".KeychainApplication"
android:allowBackup="false" android:allowBackup="false"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/Theme.Keychain.Light"> android:theme="@style/Theme.Keychain.Light">
<activity <activity

View File

@@ -23,6 +23,7 @@ import org.spongycastle.bcpg.HashAlgorithmTags;
import org.spongycastle.bcpg.PublicKeyAlgorithmTags; import org.spongycastle.bcpg.PublicKeyAlgorithmTags;
import org.spongycastle.bcpg.SymmetricKeyAlgorithmTags; import org.spongycastle.bcpg.SymmetricKeyAlgorithmTags;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
/** /**
@@ -42,24 +43,23 @@ public class PgpSecurityConstants {
* Whitelist of accepted symmetric encryption algorithms * Whitelist of accepted symmetric encryption algorithms
* all other algorithms are rejected with OpenPgpDecryptionResult.RESULT_INSECURE * all other algorithms are rejected with OpenPgpDecryptionResult.RESULT_INSECURE
*/ */
private static HashSet<Integer> sSymmetricAlgorithmsWhitelist = new HashSet<>(); private static HashSet<Integer> sSymmetricAlgorithmsWhitelist = new HashSet<>(Arrays.asList(
static { // General remarks: We try to keep the whitelist short to reduce attack surface
// General remarks: We try to keep the whitelist short to reduce attack surface // TODO: block IDEA?: Bad key schedule (weak keys), implementation difficulties (easy to make errors)
// TODO: block IDEA?: Bad key schedule (weak keys), implementation difficulties (easy to make errors) SymmetricKeyAlgorithmTags.IDEA,
sSymmetricAlgorithmsWhitelist.add(SymmetricKeyAlgorithmTags.IDEA); SymmetricKeyAlgorithmTags.TRIPLE_DES, // a MUST in RFC
sSymmetricAlgorithmsWhitelist.add(SymmetricKeyAlgorithmTags.TRIPLE_DES); // a MUST in RFC SymmetricKeyAlgorithmTags.CAST5, // default in many gpg, pgp versions, 128 bit key
sSymmetricAlgorithmsWhitelist.add(SymmetricKeyAlgorithmTags.CAST5); // default in many gpg, pgp versions, 128 bit key // BLOWFISH: Twofish is the successor
// BLOWFISH: Twofish is the successor // SAFER: not used widely
// SAFER: not used widely // DES: < 128 bit security
// DES: < 128 bit security SymmetricKeyAlgorithmTags.AES_128,
sSymmetricAlgorithmsWhitelist.add(SymmetricKeyAlgorithmTags.AES_128); SymmetricKeyAlgorithmTags.AES_192,
sSymmetricAlgorithmsWhitelist.add(SymmetricKeyAlgorithmTags.AES_192); SymmetricKeyAlgorithmTags.AES_256,
sSymmetricAlgorithmsWhitelist.add(SymmetricKeyAlgorithmTags.AES_256); SymmetricKeyAlgorithmTags.TWOFISH // 128 bit
sSymmetricAlgorithmsWhitelist.add(SymmetricKeyAlgorithmTags.TWOFISH); // 128 bit // CAMELLIA_128: not used widely
// CAMELLIA_128: not used widely // CAMELLIA_192: not used widely
// CAMELLIA_192: not used widely // CAMELLIA_256: not used widely
// CAMELLIA_256: not used widely ));
}
public static boolean isSecureSymmetricAlgorithm(int id) { public static boolean isSecureSymmetricAlgorithm(int id) {
return sSymmetricAlgorithmsWhitelist.contains(id); return sSymmetricAlgorithmsWhitelist.contains(id);
@@ -77,20 +77,19 @@ public class PgpSecurityConstants {
* ((collision resistance of 112-bits)) * ((collision resistance of 112-bits))
* Implementations SHOULD NOT sign SHA-256 hashes. They MUST NOT default to signing SHA-256 hashes. * Implementations SHOULD NOT sign SHA-256 hashes. They MUST NOT default to signing SHA-256 hashes.
*/ */
private static HashSet<Integer> sHashAlgorithmsWhitelist = new HashSet<>(); private static HashSet<Integer> sHashAlgorithmsWhitelist = new HashSet<>(Arrays.asList(
static { // MD5: broken
// MD5: broken // SHA1: broken
// SHA1: broken // RIPEMD160: same security properties as SHA1
// RIPEMD160: same security properties as SHA1 // DOUBLE_SHA: not used widely
// DOUBLE_SHA: not used widely // MD2: not used widely
// MD2: not used widely // TIGER_192: not used widely
// TIGER_192: not used widely // HAVAL_5_160: not used widely
// HAVAL_5_160: not used widely HashAlgorithmTags.SHA256, // compatibility for old Mailvelope versions
sHashAlgorithmsWhitelist.add(HashAlgorithmTags.SHA256); // compatibility for old Mailvelope versions HashAlgorithmTags.SHA384,
sHashAlgorithmsWhitelist.add(HashAlgorithmTags.SHA384); HashAlgorithmTags.SHA512
sHashAlgorithmsWhitelist.add(HashAlgorithmTags.SHA512); // SHA224: Not used widely, Yahoo argues against it
// SHA224: Not used widely, Yahoo argues against it ));
}
public static boolean isSecureHashAlgorithm(int id) { public static boolean isSecureHashAlgorithm(int id) {
return sHashAlgorithmsWhitelist.contains(id); return sHashAlgorithmsWhitelist.contains(id);
@@ -106,12 +105,11 @@ public class PgpSecurityConstants {
* bitlength less than 1023 bits. * bitlength less than 1023 bits.
* Implementations MUST NOT accept any RSA keys with bitlength less than 2047 bits after January 1, 2016. * Implementations MUST NOT accept any RSA keys with bitlength less than 2047 bits after January 1, 2016.
*/ */
private static HashSet<String> sCurveWhitelist = new HashSet<>(); private static HashSet<String> sCurveWhitelist = new HashSet<>(Arrays.asList(
static { NISTNamedCurves.getOID("P-256").getId(),
sCurveWhitelist.add(NISTNamedCurves.getOID("P-256").getId()); NISTNamedCurves.getOID("P-384").getId(),
sCurveWhitelist.add(NISTNamedCurves.getOID("P-384").getId()); NISTNamedCurves.getOID("P-521").getId()
sCurveWhitelist.add(NISTNamedCurves.getOID("P-521").getId()); ));
}
public static boolean isSecureKey(CanonicalizedPublicKey key) { public static boolean isSecureKey(CanonicalizedPublicKey key) {
switch (key.getAlgorithm()) { switch (key.getAlgorithm()) {

View File

@@ -243,7 +243,7 @@ public class AppsListFragment extends ListFragment implements
null, null,
isInstalled(packageName), isInstalled(packageName),
1, // registered! 1, // registered!
R.drawable.ic_launcher // icon is retrieved later R.mipmap.ic_launcher // icon is retrieved later
}); });
break; break;
} }
@@ -265,7 +265,7 @@ public class AppsListFragment extends ListFragment implements
name, name,
isInstalled(packageName), isInstalled(packageName),
1, // registered! 1, // registered!
R.drawable.ic_launcher // icon is retrieved later R.mipmap.ic_launcher // icon is retrieved later
}); });
break; break;
} }

View File

@@ -427,7 +427,7 @@ public class KeyserverSyncAdapterService extends Service {
private Notification getOrbotNoification(Context context) { private Notification getOrbotNoification(Context context) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(context); NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(R.drawable.ic_stat_notify_24dp) builder.setSmallIcon(R.drawable.ic_stat_notify_24dp)
.setLargeIcon(getBitmap(R.drawable.ic_launcher, context)) .setLargeIcon(getBitmap(R.mipmap.ic_launcher, context))
.setContentTitle(context.getString(R.string.keyserver_sync_orbot_notif_title)) .setContentTitle(context.getString(R.string.keyserver_sync_orbot_notif_title))
.setContentText(context.getString(R.string.keyserver_sync_orbot_notif_msg)) .setContentText(context.getString(R.string.keyserver_sync_orbot_notif_msg))
.setAutoCancel(true); .setAutoCancel(true);

View File

@@ -509,7 +509,7 @@ public class PassphraseCacheService extends Service {
private Notification getNotification() { private Notification getNotification() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this); NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.drawable.ic_stat_notify_24dp) builder.setSmallIcon(R.drawable.ic_stat_notify_24dp)
.setLargeIcon(getBitmap(R.drawable.ic_launcher, getBaseContext())) .setLargeIcon(getBitmap(R.mipmap.ic_launcher, getBaseContext()))
.setContentTitle(getResources().getQuantityString(R.plurals.passp_cache_notif_n_keys, .setContentTitle(getResources().getQuantityString(R.plurals.passp_cache_notif_n_keys,
mPassphraseCache.size(), mPassphraseCache.size())) mPassphraseCache.size(), mPassphraseCache.size()))
.setContentText(getString(R.string.passp_cache_notif_click_to_clear)); .setContentText(getString(R.string.passp_cache_notif_click_to_clear));

View File

@@ -448,7 +448,7 @@ public class DecryptListFragment
new Intent(intent) new Intent(intent)
.setClass(activity, DisplayTextActivity.class) .setClass(activity, DisplayTextActivity.class)
.putExtra(DisplayTextActivity.EXTRA_METADATA, result), .putExtra(DisplayTextActivity.EXTRA_METADATA, result),
BuildConfig.APPLICATION_ID, R.string.view_internal, R.drawable.ic_launcher); BuildConfig.APPLICATION_ID, R.string.view_internal, R.mipmap.ic_launcher);
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.intent_show)); Intent chooserIntent = Intent.createChooser(intent, getString(R.string.intent_show));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,

View File

@@ -46,7 +46,7 @@
android:id="@+id/api_app_settings_app_icon" android:id="@+id/api_app_settings_app_icon"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:src="@drawable/ic_launcher" /> android:src="@mipmap/ic_launcher" />
<TextView <TextView
android:id="@+id/api_app_settings_app_name" android:id="@+id/api_app_settings_app_name"

View File

@@ -17,7 +17,7 @@
android:layout_height="48dp" android:layout_height="48dp"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:src="@drawable/ic_launcher" /> android:src="@mipmap/ic_launcher" />
<TextView <TextView
android:id="@+id/api_app_settings_app_name" android:id="@+id/api_app_settings_app_name"

View File

@@ -11,7 +11,7 @@
android:layout_height="48dp" android:layout_height="48dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:src="@drawable/ic_launcher" /> android:src="@mipmap/ic_launcher" />
<ImageView <ImageView
android:id="@+id/api_apps_adapter_install_icon" android:id="@+id/api_apps_adapter_install_icon"

View File

@@ -32,7 +32,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top" android:layout_gravity="top"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:src="@drawable/ic_launcher" /> android:src="@mipmap/ic_launcher" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View File

@@ -54,7 +54,7 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:focusable="false" android:focusable="false"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/ic_launcher" /> android:src="@mipmap/ic_launcher" />
<!-- text protection scrim --> <!-- text protection scrim -->
<View <View

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -2,5 +2,5 @@
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android" <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountPreferences="@xml/account_preferences" android:accountPreferences="@xml/account_preferences"
android:accountType="@string/account_type" android:accountType="@string/account_type"
android:icon="@drawable/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" /> android:label="@string/app_name" />