final ui code style changes
This commit is contained in:
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain;
|
package org.sufficientlysecure.keychain;
|
||||||
|
|
||||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
|
||||||
|
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|
||||||
|
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
|
||||||
public final class Constants {
|
public final class Constants {
|
||||||
|
|
||||||
public static final boolean DEBUG = BuildConfig.DEBUG;
|
public static final boolean DEBUG = BuildConfig.DEBUG;
|
||||||
@@ -40,14 +40,14 @@ public final class Constants {
|
|||||||
|
|
||||||
public static final String INTENT_PREFIX = PACKAGE_NAME + ".action.";
|
public static final String INTENT_PREFIX = PACKAGE_NAME + ".action.";
|
||||||
|
|
||||||
public static final class path {
|
public static final class Path {
|
||||||
public static final String APP_DIR = Environment.getExternalStorageDirectory()
|
public static final String APP_DIR = Environment.getExternalStorageDirectory()
|
||||||
+ "/OpenPGP-Keychain";
|
+ "/OpenPGP-Keychain";
|
||||||
public static final String APP_DIR_FILE_SEC = APP_DIR + "/secexport.asc";
|
public static final String APP_DIR_FILE_SEC = APP_DIR + "/secexport.asc";
|
||||||
public static final String APP_DIR_FILE_PUB = APP_DIR + "/pubexport.asc";
|
public static final String APP_DIR_FILE_PUB = APP_DIR + "/pubexport.asc";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class pref {
|
public static final class Pref {
|
||||||
public static final String DEFAULT_ENCRYPTION_ALGORITHM = "defaultEncryptionAlgorithm";
|
public static final String DEFAULT_ENCRYPTION_ALGORITHM = "defaultEncryptionAlgorithm";
|
||||||
public static final String DEFAULT_HASH_ALGORITHM = "defaultHashAlgorithm";
|
public static final String DEFAULT_HASH_ALGORITHM = "defaultHashAlgorithm";
|
||||||
public static final String DEFAULT_ASCII_ARMOUR = "defaultAsciiArmour";
|
public static final String DEFAULT_ASCII_ARMOUR = "defaultAsciiArmour";
|
||||||
@@ -59,7 +59,7 @@ public final class Constants {
|
|||||||
public static final String KEY_SERVERS = "keyServers";
|
public static final String KEY_SERVERS = "keyServers";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class defaults {
|
public static final class Defaults {
|
||||||
public static final String KEY_SERVERS = "pool.sks-keyservers.net, subkeys.pgp.net, pgp.mit.edu";
|
public static final String KEY_SERVERS = "pool.sks-keyservers.net, subkeys.pgp.net, pgp.mit.edu";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class KeychainApplication extends Application {
|
|||||||
|
|
||||||
// Create APG directory on sdcard if not existing
|
// Create APG directory on sdcard if not existing
|
||||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||||
File dir = new File(Constants.path.APP_DIR);
|
File dir = new File(Constants.Path.APP_DIR);
|
||||||
if (!dir.exists() && !dir.mkdirs()) {
|
if (!dir.exists() && !dir.mkdirs()) {
|
||||||
// ignore this for now, it's not crucial
|
// ignore this for now, it's not crucial
|
||||||
// that the directory doesn't exist at this point
|
// that the directory doesn't exist at this point
|
||||||
|
|||||||
@@ -49,17 +49,17 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
return mSharedPreferences.getString(Constants.pref.LANGUAGE, "");
|
return mSharedPreferences.getString(Constants.Pref.LANGUAGE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLanguage(String value) {
|
public void setLanguage(String value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putString(Constants.pref.LANGUAGE, value);
|
editor.putString(Constants.Pref.LANGUAGE, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPassPhraseCacheTtl() {
|
public long getPassPhraseCacheTtl() {
|
||||||
int ttl = mSharedPreferences.getInt(Constants.pref.PASS_PHRASE_CACHE_TTL, 180);
|
int ttl = mSharedPreferences.getInt(Constants.Pref.PASS_PHRASE_CACHE_TTL, 180);
|
||||||
// fix the value if it was set to "never" in previous versions, which currently is not
|
// fix the value if it was set to "never" in previous versions, which currently is not
|
||||||
// supported
|
// supported
|
||||||
if (ttl == 0) {
|
if (ttl == 0) {
|
||||||
@@ -70,77 +70,77 @@ public class Preferences {
|
|||||||
|
|
||||||
public void setPassPhraseCacheTtl(int value) {
|
public void setPassPhraseCacheTtl(int value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putInt(Constants.pref.PASS_PHRASE_CACHE_TTL, value);
|
editor.putInt(Constants.Pref.PASS_PHRASE_CACHE_TTL, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDefaultEncryptionAlgorithm() {
|
public int getDefaultEncryptionAlgorithm() {
|
||||||
return mSharedPreferences.getInt(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM,
|
return mSharedPreferences.getInt(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM,
|
||||||
PGPEncryptedData.AES_256);
|
PGPEncryptedData.AES_256);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultEncryptionAlgorithm(int value) {
|
public void setDefaultEncryptionAlgorithm(int value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putInt(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM, value);
|
editor.putInt(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDefaultHashAlgorithm() {
|
public int getDefaultHashAlgorithm() {
|
||||||
return mSharedPreferences.getInt(Constants.pref.DEFAULT_HASH_ALGORITHM,
|
return mSharedPreferences.getInt(Constants.Pref.DEFAULT_HASH_ALGORITHM,
|
||||||
HashAlgorithmTags.SHA512);
|
HashAlgorithmTags.SHA512);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultHashAlgorithm(int value) {
|
public void setDefaultHashAlgorithm(int value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putInt(Constants.pref.DEFAULT_HASH_ALGORITHM, value);
|
editor.putInt(Constants.Pref.DEFAULT_HASH_ALGORITHM, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDefaultMessageCompression() {
|
public int getDefaultMessageCompression() {
|
||||||
return mSharedPreferences.getInt(Constants.pref.DEFAULT_MESSAGE_COMPRESSION,
|
return mSharedPreferences.getInt(Constants.Pref.DEFAULT_MESSAGE_COMPRESSION,
|
||||||
Id.choice.compression.zlib);
|
Id.choice.compression.zlib);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultMessageCompression(int value) {
|
public void setDefaultMessageCompression(int value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putInt(Constants.pref.DEFAULT_MESSAGE_COMPRESSION, value);
|
editor.putInt(Constants.Pref.DEFAULT_MESSAGE_COMPRESSION, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDefaultFileCompression() {
|
public int getDefaultFileCompression() {
|
||||||
return mSharedPreferences.getInt(Constants.pref.DEFAULT_FILE_COMPRESSION,
|
return mSharedPreferences.getInt(Constants.Pref.DEFAULT_FILE_COMPRESSION,
|
||||||
Id.choice.compression.none);
|
Id.choice.compression.none);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultFileCompression(int value) {
|
public void setDefaultFileCompression(int value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putInt(Constants.pref.DEFAULT_FILE_COMPRESSION, value);
|
editor.putInt(Constants.Pref.DEFAULT_FILE_COMPRESSION, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDefaultAsciiArmour() {
|
public boolean getDefaultAsciiArmour() {
|
||||||
return mSharedPreferences.getBoolean(Constants.pref.DEFAULT_ASCII_ARMOUR, false);
|
return mSharedPreferences.getBoolean(Constants.Pref.DEFAULT_ASCII_ARMOUR, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultAsciiArmour(boolean value) {
|
public void setDefaultAsciiArmour(boolean value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putBoolean(Constants.pref.DEFAULT_ASCII_ARMOUR, value);
|
editor.putBoolean(Constants.Pref.DEFAULT_ASCII_ARMOUR, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getForceV3Signatures() {
|
public boolean getForceV3Signatures() {
|
||||||
return mSharedPreferences.getBoolean(Constants.pref.FORCE_V3_SIGNATURES, false);
|
return mSharedPreferences.getBoolean(Constants.Pref.FORCE_V3_SIGNATURES, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForceV3Signatures(boolean value) {
|
public void setForceV3Signatures(boolean value) {
|
||||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
editor.putBoolean(Constants.pref.FORCE_V3_SIGNATURES, value);
|
editor.putBoolean(Constants.Pref.FORCE_V3_SIGNATURES, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getKeyServers() {
|
public String[] getKeyServers() {
|
||||||
String rawData = mSharedPreferences.getString(Constants.pref.KEY_SERVERS,
|
String rawData = mSharedPreferences.getString(Constants.Pref.KEY_SERVERS,
|
||||||
Constants.defaults.KEY_SERVERS);
|
Constants.Defaults.KEY_SERVERS);
|
||||||
Vector<String> servers = new Vector<String>();
|
Vector<String> servers = new Vector<String>();
|
||||||
String chunks[] = rawData.split(",");
|
String chunks[] = rawData.split(",");
|
||||||
for (String c : chunks) {
|
for (String c : chunks) {
|
||||||
@@ -165,7 +165,7 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
rawData += tmp;
|
rawData += tmp;
|
||||||
}
|
}
|
||||||
editor.putString(Constants.pref.KEY_SERVERS, rawData);
|
editor.putString(Constants.Pref.KEY_SERVERS, rawData);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class KeychainServiceBlobProvider extends ContentProvider {
|
public class KeychainServiceBlobProvider extends ContentProvider {
|
||||||
private static final String STORE_PATH = Constants.path.APP_DIR + "/ApgBlobs";
|
private static final String STORE_PATH = Constants.Path.APP_DIR + "/ApgBlobs";
|
||||||
|
|
||||||
private KeychainServiceBlobDatabase mBlobDatabase = null;
|
private KeychainServiceBlobDatabase mBlobDatabase = null;
|
||||||
|
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
if (filename.endsWith(".asc") || filename.endsWith(".gpg") || filename.endsWith(".pgp")) {
|
if (filename.endsWith(".asc") || filename.endsWith(".gpg") || filename.endsWith(".pgp")) {
|
||||||
filename = filename.substring(0, filename.length() - 4);
|
filename = filename.substring(0, filename.length() - 4);
|
||||||
}
|
}
|
||||||
mOutputFilename = Constants.path.APP_DIR + "/" + filename;
|
mOutputFilename = Constants.Path.APP_DIR + "/" + filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSource() {
|
private void updateSource() {
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ public class EditKeyActivity extends ActionBarActivity {
|
|||||||
return true;
|
return true;
|
||||||
case R.id.menu_key_edit_export_file:
|
case R.id.menu_key_edit_export_file:
|
||||||
long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())};
|
long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())};
|
||||||
mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.path.APP_DIR_FILE_SEC);
|
mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC);
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_key_edit_delete: {
|
case R.id.menu_key_edit_delete: {
|
||||||
// Message is received after key is deleted
|
// Message is received after key is deleted
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class ImportKeysFileFragment extends Fragment {
|
|||||||
// open .asc or .gpg files
|
// open .asc or .gpg files
|
||||||
// setting it to text/plain prevents Cynaogenmod's file manager from selecting asc
|
// setting it to text/plain prevents Cynaogenmod's file manager from selecting asc
|
||||||
// or gpg types!
|
// or gpg types!
|
||||||
FileHelper.openFile(ImportKeysFileFragment.this, Constants.path.APP_DIR + "/",
|
FileHelper.openFile(ImportKeysFileFragment.this, Constants.Path.APP_DIR + "/",
|
||||||
"*/*", Id.request.filename);
|
"*/*", Id.request.filename);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class KeyListActivity extends DrawerActivity {
|
|||||||
return true;
|
return true;
|
||||||
case R.id.menu_key_list_export:
|
case R.id.menu_key_list_export:
|
||||||
// TODO fix this for unified keylist
|
// TODO fix this for unified keylist
|
||||||
mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB);
|
mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_key_list_create:
|
case R.id.menu_key_list_create:
|
||||||
@@ -71,7 +71,7 @@ public class KeyListActivity extends DrawerActivity {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_key_list_secret_export:
|
case R.id.menu_key_list_secret_export:
|
||||||
mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.path.APP_DIR_FILE_SEC);
|
mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.Path.APP_DIR_FILE_SEC);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ public class KeyListFragment extends Fragment
|
|||||||
mExportHelper
|
mExportHelper
|
||||||
.showExportKeysDialog(ids,
|
.showExportKeysDialog(ids,
|
||||||
Id.type.public_key,
|
Id.type.public_key,
|
||||||
Constants.path.APP_DIR_FILE_PUB);
|
Constants.Path.APP_DIR_FILE_PUB);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case R.id.menu_key_list_multi_select_all: {
|
case R.id.menu_key_list_multi_select_all: {
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
addPreferencesFromResource(R.xml.gen_preferences);
|
addPreferencesFromResource(R.xml.gen_preferences);
|
||||||
|
|
||||||
initializePassPassPhraceCacheTtl(
|
initializePassPassPhraceCacheTtl(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.PASS_PHRASE_CACHE_TTL));
|
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
||||||
|
|
||||||
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.pref.KEY_SERVERS);
|
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
||||||
String servers[] = mPreferences.getKeyServers();
|
String servers[] = mPreferences.getKeyServers();
|
||||||
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
||||||
servers.length, servers.length));
|
servers.length, servers.length));
|
||||||
@@ -78,7 +78,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
addPreferencesFromResource(R.xml.adv_preferences);
|
addPreferencesFromResource(R.xml.adv_preferences);
|
||||||
|
|
||||||
initializeEncryptionAlgorithm(
|
initializeEncryptionAlgorithm(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
||||||
|
|
||||||
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
||||||
Id.choice.compression.zlib, Id.choice.compression.bzip2, };
|
Id.choice.compression.zlib, Id.choice.compression.bzip2, };
|
||||||
@@ -93,22 +93,22 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initializeHashAlgorithm(
|
initializeHashAlgorithm(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_HASH_ALGORITHM),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_HASH_ALGORITHM),
|
||||||
valueIds, entries, values);
|
valueIds, entries, values);
|
||||||
|
|
||||||
initializeMessageCompression(
|
initializeMessageCompression(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_MESSAGE_COMPRESSION),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_MESSAGE_COMPRESSION),
|
||||||
valueIds, entries, values);
|
valueIds, entries, values);
|
||||||
|
|
||||||
initializeFileCompression(
|
initializeFileCompression(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_FILE_COMPRESSION),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
|
||||||
entries, values);
|
entries, values);
|
||||||
|
|
||||||
initializeAsciiArmour(
|
initializeAsciiArmour(
|
||||||
(CheckBoxPreference) findPreference(Constants.pref.DEFAULT_ASCII_ARMOUR));
|
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOUR));
|
||||||
|
|
||||||
initializeForceV3Signatures(
|
initializeForceV3Signatures(
|
||||||
(CheckBoxPreference) findPreference(Constants.pref.FORCE_V3_SIGNATURES));
|
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
|
||||||
|
|
||||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||||
// Load the legacy preferences headers
|
// Load the legacy preferences headers
|
||||||
@@ -160,9 +160,9 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
addPreferencesFromResource(R.xml.gen_preferences);
|
addPreferencesFromResource(R.xml.gen_preferences);
|
||||||
|
|
||||||
initializePassPassPhraceCacheTtl(
|
initializePassPassPhraceCacheTtl(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.PASS_PHRASE_CACHE_TTL));
|
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
||||||
|
|
||||||
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.pref.KEY_SERVERS);
|
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
||||||
String servers[] = mPreferences.getKeyServers();
|
String servers[] = mPreferences.getKeyServers();
|
||||||
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
||||||
servers.length, servers.length));
|
servers.length, servers.length));
|
||||||
@@ -215,7 +215,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
addPreferencesFromResource(R.xml.adv_preferences);
|
addPreferencesFromResource(R.xml.adv_preferences);
|
||||||
|
|
||||||
initializeEncryptionAlgorithm(
|
initializeEncryptionAlgorithm(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
||||||
|
|
||||||
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
||||||
Id.choice.compression.zlib, Id.choice.compression.bzip2, };
|
Id.choice.compression.zlib, Id.choice.compression.bzip2, };
|
||||||
@@ -230,22 +230,22 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initializeHashAlgorithm(
|
initializeHashAlgorithm(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_HASH_ALGORITHM),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_HASH_ALGORITHM),
|
||||||
valueIds, entries, values);
|
valueIds, entries, values);
|
||||||
|
|
||||||
initializeMessageCompression(
|
initializeMessageCompression(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_MESSAGE_COMPRESSION),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_MESSAGE_COMPRESSION),
|
||||||
valueIds, entries, values);
|
valueIds, entries, values);
|
||||||
|
|
||||||
initializeFileCompression(
|
initializeFileCompression(
|
||||||
(IntegerListPreference) findPreference(Constants.pref.DEFAULT_FILE_COMPRESSION),
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_FILE_COMPRESSION),
|
||||||
entries, values);
|
entries, values);
|
||||||
|
|
||||||
initializeAsciiArmour(
|
initializeAsciiArmour(
|
||||||
(CheckBoxPreference) findPreference(Constants.pref.DEFAULT_ASCII_ARMOUR));
|
(CheckBoxPreference) findPreference(Constants.Pref.DEFAULT_ASCII_ARMOUR));
|
||||||
|
|
||||||
initializeForceV3Signatures(
|
initializeForceV3Signatures(
|
||||||
(CheckBoxPreference) findPreference(Constants.pref.FORCE_V3_SIGNATURES));
|
(CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public class ViewKeyActivity extends ActionBarActivity {
|
|||||||
return true;
|
return true;
|
||||||
case R.id.menu_key_view_export_file:
|
case R.id.menu_key_view_export_file:
|
||||||
long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())};
|
long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())};
|
||||||
mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB);
|
mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.Path.APP_DIR_FILE_PUB);
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_key_view_share_default_fingerprint:
|
case R.id.menu_key_view_share_default_fingerprint:
|
||||||
shareKey(mDataUri, true);
|
shareKey(mDataUri, true);
|
||||||
|
|||||||
@@ -78,17 +78,18 @@ public class HkpKeyServer extends KeyServer {
|
|||||||
// pub 2048R/<a href="/pks/lookup?op=get&search=0x887DF4BE9F5C9090">9F5C9090</a> 2009-08-17 <a
|
// pub 2048R/<a href="/pks/lookup?op=get&search=0x887DF4BE9F5C9090">9F5C9090</a> 2009-08-17 <a
|
||||||
// href="/pks/lookup?op=vindex&search=0x887DF4BE9F5C9090">Jörg Runge
|
// href="/pks/lookup?op=vindex&search=0x887DF4BE9F5C9090">Jörg Runge
|
||||||
// <joerg@joergrunge.de></a>
|
// <joerg@joergrunge.de></a>
|
||||||
public static Pattern PUB_KEY_LINE = Pattern
|
public static final Pattern PUB_KEY_LINE = Pattern
|
||||||
.compile(
|
.compile(
|
||||||
"pub +([0-9]+)([a-z]+)/.*?0x([0-9a-z]+).*? +([0-9-]+) +(.+)[\n\r]+((?: +.+[\n\r]+)*)",
|
"pub +([0-9]+)([a-z]+)/.*?0x([0-9a-z]+).*? +([0-9-]+) +(.+)[\n\r]+((?: +.+[\n\r]+)*)",
|
||||||
Pattern.CASE_INSENSITIVE);
|
Pattern.CASE_INSENSITIVE);
|
||||||
public static Pattern USER_ID_LINE = Pattern.compile("^ +(.+)$", Pattern.MULTILINE
|
public static final Pattern USER_ID_LINE = Pattern.compile("^ +(.+)$", Pattern.MULTILINE
|
||||||
| Pattern.CASE_INSENSITIVE);
|
| Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
private static final short PORT_DEFAULT = 11371;
|
private static final short PORT_DEFAULT = 11371;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param hostAndPort may be just "<code>hostname</code>" (eg. "<code>pool.sks-keyservers.net</code>"), then it will
|
* @param hostAndPort may be just
|
||||||
|
* "<code>hostname</code>" (eg. "<code>pool.sks-keyservers.net</code>"), then it will
|
||||||
* connect using {@link #PORT_DEFAULT}. However, port may be specified after colon
|
* connect using {@link #PORT_DEFAULT}. However, port may be specified after colon
|
||||||
* ("<code>hostname:port</code>", eg. "<code>p80.pool.sks-keyservers.net:80</code>").
|
* ("<code>hostname:port</code>", eg. "<code>p80.pool.sks-keyservers.net:80</code>").
|
||||||
*/
|
*/
|
||||||
@@ -110,7 +111,7 @@ public class HkpKeyServer extends KeyServer {
|
|||||||
mPort = port;
|
mPort = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
static private String readAll(InputStream in, String encoding) throws IOException {
|
private static String readAll(InputStream in, String encoding) throws IOException {
|
||||||
ByteArrayOutputStream raw = new ByteArrayOutputStream();
|
ByteArrayOutputStream raw = new ByteArrayOutputStream();
|
||||||
|
|
||||||
byte buffer[] = new byte[1 << 16];
|
byte buffer[] = new byte[1 << 16];
|
||||||
|
|||||||
Reference in New Issue
Block a user