Merge branch 'development' of github.com:open-keychain/open-keychain into development
@ -83,6 +83,7 @@ public final class Constants {
|
||||
public static final String SEARCH_KEYSERVER = "search_keyserver_pref";
|
||||
public static final String SEARCH_KEYBASE = "search_keybase_pref";
|
||||
public static final String USE_DEFAULT_YUBIKEY_PIN = "useDefaultYubikeyPin";
|
||||
public static final String USE_NUMKEYPAD_FOR_YUBIKEY_PIN="useNumKeypadForYubikeyPin";
|
||||
}
|
||||
|
||||
public static final class Defaults {
|
||||
|
@ -27,6 +27,8 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.text.InputType;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
@ -52,6 +54,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
/**
|
||||
* We can not directly create a dialog on the application context.
|
||||
@ -138,6 +141,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
alert.setTitle(R.string.title_authentication);
|
||||
|
||||
String userId;
|
||||
CanonicalizedSecretKey.SecretKeyType keyType = CanonicalizedSecretKey.SecretKeyType.PASSPHRASE;
|
||||
|
||||
if (mSubKeyId == Constants.key.symmetric || mSubKeyId == Constants.key.none) {
|
||||
alert.setMessage(R.string.passphrase_for_symmetric_encryption);
|
||||
@ -161,7 +165,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
long masterKeyId = new ProviderHelper(activity).getMasterKeyId(mSubKeyId);
|
||||
CachedPublicKeyRing keyRing = new ProviderHelper(activity).getCachedPublicKeyRing(masterKeyId);
|
||||
// get the type of key (from the database)
|
||||
CanonicalizedSecretKey.SecretKeyType keyType = keyRing.getSecretKeyType(mSubKeyId);
|
||||
keyType = keyRing.getSecretKeyType(mSubKeyId);
|
||||
switch (keyType) {
|
||||
case PASSPHRASE:
|
||||
message = getString(R.string.passphrase_for, userId);
|
||||
@ -231,6 +235,14 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
mPassphraseEditText.setImeActionLabel(getString(android.R.string.ok), EditorInfo.IME_ACTION_DONE);
|
||||
mPassphraseEditText.setOnEditorActionListener(this);
|
||||
|
||||
if (keyType == CanonicalizedSecretKey.SecretKeyType.DIVERT_TO_CARD && Preferences.getPreferences(activity).useNumKeypadForYubikeyPin()) {
|
||||
mPassphraseEditText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
} else {
|
||||
mPassphraseEditText.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
}
|
||||
|
||||
mPassphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
|
||||
AlertDialog dialog = alert.create();
|
||||
dialog.setButton(DialogInterface.BUTTON_POSITIVE,
|
||||
activity.getString(android.R.string.ok), (DialogInterface.OnClickListener) null);
|
||||
|
@ -127,6 +127,9 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
initializeUseDefaultYubikeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_DEFAULT_YUBIKEY_PIN));
|
||||
|
||||
initializeUseNumKeypadForYubikeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN));
|
||||
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
// Load the legacy preferences headers
|
||||
addPreferencesFromResource(R.xml.preference_headers_legacy);
|
||||
@ -278,6 +281,9 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
|
||||
initializeUseDefaultYubikeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_DEFAULT_YUBIKEY_PIN));
|
||||
|
||||
initializeUseNumKeypadForYubikeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN));
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,4 +469,14 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private static void initializeUseNumKeypadForYubikeyPin(final CheckBoxPreference mUseNumKeypadForYubikeyPin) {
|
||||
mUseNumKeypadForYubikeyPin.setChecked(sPreferences.useNumKeypadForYubikeyPin());
|
||||
mUseNumKeypadForYubikeyPin.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mUseNumKeypadForYubikeyPin.setChecked((Boolean) newValue);
|
||||
sPreferences.setUseNumKeypadForYubikeyPin((Boolean) newValue);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ import android.os.Messenger;
|
||||
import android.os.RemoteException;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.text.InputType;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -54,6 +56,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
public class PassphraseDialogFragment extends DialogFragment implements OnEditorActionListener {
|
||||
private static final String ARG_MESSENGER = "messenger";
|
||||
@ -132,6 +135,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
||||
alert.setTitle(R.string.title_authentication);
|
||||
|
||||
String userId;
|
||||
CanonicalizedSecretKey.SecretKeyType keyType = CanonicalizedSecretKey.SecretKeyType.PASSPHRASE;
|
||||
|
||||
if (mSubKeyId == Constants.key.symmetric || mSubKeyId == Constants.key.none) {
|
||||
alert.setMessage(R.string.passphrase_for_symmetric_encryption);
|
||||
@ -155,7 +159,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
||||
long masterKeyId = new ProviderHelper(getActivity()).getMasterKeyId(mSubKeyId);
|
||||
CachedPublicKeyRing keyRing = new ProviderHelper(getActivity()).getCachedPublicKeyRing(masterKeyId);
|
||||
// get the type of key (from the database)
|
||||
CanonicalizedSecretKey.SecretKeyType keyType = keyRing.getSecretKeyType(mSubKeyId);
|
||||
keyType = keyRing.getSecretKeyType(mSubKeyId);
|
||||
switch (keyType) {
|
||||
case PASSPHRASE:
|
||||
message = getString(R.string.passphrase_for, userId);
|
||||
@ -226,6 +230,13 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
|
||||
mPassphraseEditText.setImeActionLabel(getString(android.R.string.ok), EditorInfo.IME_ACTION_DONE);
|
||||
mPassphraseEditText.setOnEditorActionListener(this);
|
||||
|
||||
if (keyType == CanonicalizedSecretKey.SecretKeyType.DIVERT_TO_CARD && Preferences.getPreferences(activity).useNumKeypadForYubikeyPin()) {
|
||||
mPassphraseEditText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
} else {
|
||||
mPassphraseEditText.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
}
|
||||
mPassphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
|
||||
AlertDialog dialog = alert.create();
|
||||
dialog.setButton(DialogInterface.BUTTON_POSITIVE,
|
||||
activity.getString(android.R.string.ok), (DialogInterface.OnClickListener) null);
|
||||
|
@ -191,6 +191,16 @@ public class Preferences {
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public boolean useNumKeypadForYubikeyPin() {
|
||||
return mSharedPreferences.getBoolean(Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN, false);
|
||||
}
|
||||
|
||||
public void setUseNumKeypadForYubikeyPin(boolean useNumKeypadForYubikeyPin) {
|
||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||
editor.putBoolean(Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN, useNumKeypadForYubikeyPin);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public void setFirstTime(boolean value) {
|
||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||
editor.putBoolean(Constants.Pref.FIRST_TIME, value);
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.0 KiB |
@ -19,7 +19,6 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:hint="@string/label_passphrase"
|
||||
android:ems="10"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
@ -49,7 +49,7 @@
|
||||
<string name="section_advanced">"Advanced"</string>
|
||||
<string name="section_certify">"Certify"</string>
|
||||
<string name="section_actions">"Actions"</string>
|
||||
<string name="section_share_key">"Public key"</string>
|
||||
<string name="section_share_key">"Key"</string>
|
||||
<string name="section_certification_key">"Your Key used for certification"</string>
|
||||
<string name="section_upload_key">"Synchronize Key"</string>
|
||||
<string name="section_key_server">"Keyserver"</string>
|
||||
@ -112,6 +112,7 @@
|
||||
<string name="label_write_version_header">"Let others know that you're using OpenKeychain"</string>
|
||||
<string name="label_write_version_header_summary">"Writes 'OpenKeychain v2.7' to OpenPGP signatures, ciphertext, and exported keys"</string>
|
||||
<string name="label_use_default_yubikey_pin">"Use default Yubikey PIN"</string>
|
||||
<string name="label_use_num_keypad_for_yubikey_pin">Use number keypad for Yubikey PIN</string>
|
||||
<string name="label_label_use_default_yubikey_pin_summary">"Uses default PIN (123456) to access Yubikeys over NFC"</string>
|
||||
<string name="label_asymmetric_from">"Signed by:"</string>
|
||||
<string name="label_to">"Encrypt to:"</string>
|
||||
@ -836,8 +837,8 @@
|
||||
<string name="msg_con_error_io_secret">"IO error writing secret keys to cache!"</string>
|
||||
<string name="msg_con_error_public">"Error reimporting public keys!"</string>
|
||||
<string name="msg_con_error_secret">"Error reimporting secret keys!"</string>
|
||||
<string name="msg_con_recover">"Recovering consolidation"</string>
|
||||
<string name="msg_con_recover_unknown">"Recovering from unknown state"</string>
|
||||
<string name="msg_con_recover">"Resuming consolidation process"</string>
|
||||
<string name="msg_con_recover_unknown">"Resuming consolidation process from unknown state"</string>
|
||||
<plurals name="msg_con_reimport_public">
|
||||
<item quantity="one">"Reimporting one public key"</item>
|
||||
<item quantity="other">"Reimporting %d public keys"</item>
|
||||
|
@ -44,5 +44,9 @@
|
||||
android:defaultValue="true"
|
||||
android:title="@string/label_use_default_yubikey_pin"
|
||||
android:summary="@string/label_label_use_default_yubikey_pin_summary" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="useNumKeypadForYubikeyPin"
|
||||
android:persistent="false"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/label_use_num_keypad_for_yubikey_pin" />
|
||||
</PreferenceScreen>
|
||||
|
1619
Resources/graphics/All_Icons.svg
Normal file
After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 20 KiB |