mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-14 04:45:04 -05:00
Fix YubiKey naming, cleanup
This commit is contained in:
parent
f41758261f
commit
3668c8897d
@ -167,7 +167,7 @@ public class OpenPgpService extends RemoteService {
|
||||
switch (requiredInput.mType) {
|
||||
case NFC_DECRYPT:
|
||||
case NFC_SIGN: {
|
||||
// build PendingIntent for Yubikey NFC operations
|
||||
// build PendingIntent for YubiKey NFC operations
|
||||
Intent intent = new Intent(context, NfcOperationActivity.class);
|
||||
// pass params through to activity that it can be returned again later to repeat pgp operation
|
||||
intent.putExtra(NfcOperationActivity.EXTRA_SERVICE_INTENT, data);
|
||||
|
@ -245,11 +245,11 @@ public class PassphraseCacheService extends Service {
|
||||
|
||||
switch (keyType) {
|
||||
case DIVERT_TO_CARD:
|
||||
if (Preferences.getPreferences(this).useDefaultYubikeyPin()) {
|
||||
Log.d(Constants.TAG, "PassphraseCacheService: Using default Yubikey PIN: 123456");
|
||||
return new Passphrase("123456"); // default Yubikey PIN, see http://www.yubico.com/2012/12/yubikey-neo-openpgp/
|
||||
if (Preferences.getPreferences(this).useDefaultYubiKeyPin()) {
|
||||
Log.d(Constants.TAG, "PassphraseCacheService: Using default YubiKey PIN: 123456");
|
||||
return new Passphrase("123456"); // default YubiKey PIN, see http://www.yubico.com/2012/12/yubikey-neo-openpgp/
|
||||
} else {
|
||||
Log.d(Constants.TAG, "PassphraseCacheService: NOT using default Yubikey PIN");
|
||||
Log.d(Constants.TAG, "PassphraseCacheService: NOT using default YubiKey PIN");
|
||||
break;
|
||||
}
|
||||
case PASSPHRASE_EMPTY:
|
||||
|
@ -85,25 +85,6 @@ public abstract class DecryptFragment extends CryptoOperationFragment {
|
||||
startActivity(viewKeyIntent);
|
||||
}
|
||||
|
||||
// protected void startPassphraseDialog(long subkeyId) {
|
||||
// Intent intent = new Intent(getActivity(), PassphraseDialogActivity.class);
|
||||
// intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, subkeyId);
|
||||
// startActivityForResult(intent, REQUEST_CODE_PASSPHRASE);
|
||||
// }
|
||||
//
|
||||
// protected void startNfcDecrypt(long subKeyId, Passphrase pin, byte[] encryptedSessionKey) {
|
||||
// // build PendingIntent for Yubikey NFC operations
|
||||
// Intent intent = new Intent(getActivity(), NfcActivity.class);
|
||||
// intent.setAction(NfcActivity.ACTION_DECRYPT_SESSION_KEY);
|
||||
// intent.putExtra(NfcActivity.EXTRA_SERVICE_INTENT, new Intent()); // not used, only relevant to OpenPgpService
|
||||
// intent.putExtra(NfcActivity.EXTRA_KEY_ID, subKeyId);
|
||||
// intent.putExtra(NfcActivity.EXTRA_PIN, pin);
|
||||
//
|
||||
// intent.putExtra(NfcActivity.EXTRA_NFC_ENC_SESSION_KEY, encryptedSessionKey);
|
||||
//
|
||||
// startActivityForResult(intent, REQUEST_CODE_NFC_DECRYPT);
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* @return returns false if signature is invalid, key is revoked or expired.
|
||||
|
@ -6,9 +6,7 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@ -56,7 +54,7 @@ public class NfcOperationActivity extends BaseNfcActivity {
|
||||
mServiceIntent = data.getParcelable(EXTRA_SERVICE_INTENT);
|
||||
|
||||
// obtain passphrase for this subkey
|
||||
obtainYubikeyPin(RequiredInputParcel.createRequiredPassphrase(mRequiredInput));
|
||||
obtainYubiKeyPin(RequiredInputParcel.createRequiredPassphrase(mRequiredInput));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,7 +104,7 @@ public class NfcOperationActivity extends BaseNfcActivity {
|
||||
|
||||
// avoid a loop
|
||||
Preferences prefs = Preferences.getPreferences(this);
|
||||
if (prefs.useDefaultYubikeyPin()) {
|
||||
if (prefs.useDefaultYubiKeyPin()) {
|
||||
toast(getString(R.string.error_pin_nodefault));
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
@ -117,7 +115,7 @@ public class NfcOperationActivity extends BaseNfcActivity {
|
||||
PassphraseCacheService.clearCachedPassphrase(
|
||||
this, mRequiredInput.getMasterKeyId(), mRequiredInput.getSubKeyId());
|
||||
|
||||
obtainYubikeyPin(RequiredInputParcel.createRequiredPassphrase(mRequiredInput));
|
||||
obtainYubiKeyPin(RequiredInputParcel.createRequiredPassphrase(mRequiredInput));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ 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()) {
|
||||
if (keyType == CanonicalizedSecretKey.SecretKeyType.DIVERT_TO_CARD && Preferences.getPreferences(activity).useNumKeypadForYubiKeyPin()) {
|
||||
mPassphraseEditText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
} else if (keyType == CanonicalizedSecretKey.SecretKeyType.PIN) {
|
||||
mPassphraseEditText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
|
@ -107,10 +107,10 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
values[i] = "" + valueIds[i];
|
||||
}
|
||||
|
||||
initializeUseDefaultYubikeyPin(
|
||||
initializeUseDefaultYubiKeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_DEFAULT_YUBIKEY_PIN));
|
||||
|
||||
initializeUseNumKeypadForYubikeyPin(
|
||||
initializeUseNumKeypadForYubiKeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN));
|
||||
|
||||
}
|
||||
@ -262,10 +262,10 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
values[i] = "" + valueIds[i];
|
||||
}
|
||||
|
||||
initializeUseDefaultYubikeyPin(
|
||||
initializeUseDefaultYubiKeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_DEFAULT_YUBIKEY_PIN));
|
||||
|
||||
initializeUseNumKeypadForYubikeyPin(
|
||||
initializeUseNumKeypadForYubiKeyPin(
|
||||
(CheckBoxPreference) findPreference(Constants.Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN));
|
||||
}
|
||||
}
|
||||
@ -335,23 +335,23 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
return serverSummary + "; " + context.getString(R.string.label_preferred) + ": " + sPreferences.getPreferredKeyserver();
|
||||
}
|
||||
|
||||
private static void initializeUseDefaultYubikeyPin(final CheckBoxPreference mUseDefaultYubikeyPin) {
|
||||
mUseDefaultYubikeyPin.setChecked(sPreferences.useDefaultYubikeyPin());
|
||||
mUseDefaultYubikeyPin.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
private static void initializeUseDefaultYubiKeyPin(final CheckBoxPreference mUseDefaultYubiKeyPin) {
|
||||
mUseDefaultYubiKeyPin.setChecked(sPreferences.useDefaultYubiKeyPin());
|
||||
mUseDefaultYubiKeyPin.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mUseDefaultYubikeyPin.setChecked((Boolean) newValue);
|
||||
sPreferences.setUseDefaultYubikeyPin((Boolean) newValue);
|
||||
mUseDefaultYubiKeyPin.setChecked((Boolean) newValue);
|
||||
sPreferences.setUseDefaultYubiKeyPin((Boolean) newValue);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void initializeUseNumKeypadForYubikeyPin(final CheckBoxPreference mUseNumKeypadForYubikeyPin) {
|
||||
mUseNumKeypadForYubikeyPin.setChecked(sPreferences.useNumKeypadForYubikeyPin());
|
||||
mUseNumKeypadForYubikeyPin.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
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);
|
||||
mUseNumKeypadForYubiKeyPin.setChecked((Boolean) newValue);
|
||||
sPreferences.setUseNumKeypadForYubiKeyPin((Boolean) newValue);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -281,7 +281,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||
byte[] nfcFingerprints = intent.getByteArrayExtra(EXTRA_NFC_FINGERPRINTS);
|
||||
String nfcUserId = intent.getStringExtra(EXTRA_NFC_USER_ID);
|
||||
byte[] nfcAid = intent.getByteArrayExtra(EXTRA_NFC_AID);
|
||||
showYubikeyFragment(nfcFingerprints, nfcUserId, nfcAid);
|
||||
showYubiKeyFragment(nfcFingerprints, nfcUserId, nfcAid);
|
||||
}
|
||||
|
||||
}
|
||||
@ -593,12 +593,12 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
showYubikeyFragment(nfcFingerprints, nfcUserId, nfcAid);
|
||||
showYubiKeyFragment(nfcFingerprints, nfcUserId, nfcAid);
|
||||
|
||||
}
|
||||
|
||||
public void showYubikeyFragment(byte[] nfcFingerprints, String nfcUserId, byte[] nfcAid) {
|
||||
ViewKeyYubikeyFragment frag = ViewKeyYubikeyFragment.newInstance(
|
||||
public void showYubiKeyFragment(byte[] nfcFingerprints, String nfcUserId, byte[] nfcAid) {
|
||||
ViewKeyYubiKeyFragment frag = ViewKeyYubiKeyFragment.newInstance(
|
||||
nfcFingerprints, nfcUserId, nfcAid);
|
||||
|
||||
FragmentManager manager = getSupportFragmentManager();
|
||||
|
@ -4,7 +4,6 @@ package org.sufficientlysecure.keychain.ui;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
@ -29,11 +28,10 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
|
||||
|
||||
public class ViewKeyYubikeyFragment extends Fragment
|
||||
public class ViewKeyYubiKeyFragment extends Fragment
|
||||
implements LoaderCallbacks<Cursor> {
|
||||
|
||||
public static final String ARG_FINGERPRINT = "fingerprint";
|
||||
@ -46,9 +44,9 @@ public class ViewKeyYubikeyFragment extends Fragment
|
||||
private Button vButton;
|
||||
private TextView vStatus;
|
||||
|
||||
public static ViewKeyYubikeyFragment newInstance(byte[] fingerprints, String userId, byte[] aid) {
|
||||
public static ViewKeyYubiKeyFragment newInstance(byte[] fingerprints, String userId, byte[] aid) {
|
||||
|
||||
ViewKeyYubikeyFragment frag = new ViewKeyYubikeyFragment();
|
||||
ViewKeyYubiKeyFragment frag = new ViewKeyYubiKeyFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putByteArray(ARG_FINGERPRINT, fingerprints);
|
@ -1,5 +1,21 @@
|
||||
package org.sufficientlysecure.keychain.ui.base;
|
||||
/*
|
||||
* Copyright (C) 2014-2015 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.sufficientlysecure.keychain.ui.base;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -35,7 +51,6 @@ import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Passphrase;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
|
||||
public abstract class BaseNfcActivity extends BaseActivity {
|
||||
|
||||
public static final int REQUEST_CODE_PASSPHRASE = 1;
|
||||
@ -108,10 +123,10 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
||||
enableNfcForegroundDispatch();
|
||||
}
|
||||
|
||||
protected void obtainYubikeyPin(RequiredInputParcel requiredInput) {
|
||||
protected void obtainYubiKeyPin(RequiredInputParcel requiredInput) {
|
||||
|
||||
Preferences prefs = Preferences.getPreferences(this);
|
||||
if (prefs.useDefaultYubikeyPin()) {
|
||||
if (prefs.useDefaultYubiKeyPin()) {
|
||||
mPin = new Passphrase("123456");
|
||||
return;
|
||||
}
|
||||
@ -123,7 +138,7 @@ public abstract class BaseNfcActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
|
||||
protected void setYubikeyPin(Passphrase pin) {
|
||||
protected void setYubiKeyPin(Passphrase pin) {
|
||||
mPin = pin;
|
||||
}
|
||||
|
||||
|
@ -109,21 +109,21 @@ public class Preferences {
|
||||
return mSharedPreferences.getBoolean(Constants.Pref.FIRST_TIME, true);
|
||||
}
|
||||
|
||||
public boolean useDefaultYubikeyPin() {
|
||||
public boolean useDefaultYubiKeyPin() {
|
||||
return mSharedPreferences.getBoolean(Pref.USE_DEFAULT_YUBIKEY_PIN, false);
|
||||
}
|
||||
|
||||
public void setUseDefaultYubikeyPin(boolean useDefaultYubikeyPin) {
|
||||
public void setUseDefaultYubiKeyPin(boolean useDefaultYubikeyPin) {
|
||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||
editor.putBoolean(Pref.USE_DEFAULT_YUBIKEY_PIN, useDefaultYubikeyPin);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public boolean useNumKeypadForYubikeyPin() {
|
||||
public boolean useNumKeypadForYubiKeyPin() {
|
||||
return mSharedPreferences.getBoolean(Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN, true);
|
||||
}
|
||||
|
||||
public void setUseNumKeypadForYubikeyPin(boolean useNumKeypadForYubikeyPin) {
|
||||
public void setUseNumKeypadForYubiKeyPin(boolean useNumKeypadForYubikeyPin) {
|
||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||
editor.putBoolean(Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN, useNumKeypadForYubikeyPin);
|
||||
editor.commit();
|
||||
|
@ -35,7 +35,7 @@
|
||||
* Redesigned decrypt screen
|
||||
* New icon usage and colors
|
||||
* Fix import of secret keys from Symantec Encryption Desktop
|
||||
* Subkey IDs on Yubikeys are now checked correctly
|
||||
* Subkey IDs on YubiKeys are now checked correctly
|
||||
|
||||
|
||||
## 3.0.1
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
## 3.0
|
||||
|
||||
* Full support for Yubikey signature generation and decryption!
|
||||
* Full support for YubiKey signature generation and decryption!
|
||||
* Propose installable compatible apps in apps list
|
||||
* New design for decryption screens
|
||||
* Many fixes for key import, also fixes stripped keys
|
||||
@ -60,7 +60,7 @@
|
||||
## 2.9.2
|
||||
|
||||
* Fix keys broken in 2.9.1
|
||||
* Yubikey decryption now working via API
|
||||
* YubiKey decryption now working via API
|
||||
|
||||
|
||||
## 2.9.1
|
||||
@ -69,7 +69,7 @@
|
||||
* Fix key flags handling (now supporting Mailvelope 0.7 keys)
|
||||
* Improved passphrase handling
|
||||
* Key sharing via SafeSlinger
|
||||
* Yubikey: preference to allow other PINs, currently only signing via the OpenPGP API works, not inside of OpenKeychain
|
||||
* YubiKey: preference to allow other PINs, currently only signing via the OpenPGP API works, not inside of OpenKeychain
|
||||
* Fix usage of stripped keys
|
||||
* SHA256 as default for compatibility
|
||||
* Intent API has changed, see https://github.com/open-keychain/open-keychain/wiki/Intent-API
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
* Fixing crashes introduced in v2.8
|
||||
* Experimental ECC support
|
||||
* Experimental Yubikey support (signing-only with imported keys)
|
||||
* Experimental YubiKey support (signing-only with imported keys)
|
||||
|
||||
|
||||
## 2.8
|
||||
|
Loading…
Reference in New Issue
Block a user