Yubikey: use PIN

This commit is contained in:
Dominik Schürmann 2014-09-08 00:40:50 +02:00
parent 7ccd30b78e
commit f4592c8b95
4 changed files with 11 additions and 3 deletions

View File

@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.helper;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import org.spongycastle.bcpg.CompressionAlgorithmTags;
import org.spongycastle.bcpg.HashAlgorithmTags;
@ -51,8 +52,13 @@ public class Preferences {
}
private Preferences(Context context) {
// multi-process preferences
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mSharedPreferences = context.getSharedPreferences("APG.main", Context.MODE_MULTI_PROCESS);
} else {
mSharedPreferences = context.getSharedPreferences("APG.main", Context.MODE_PRIVATE);
}
}
public String getLanguage() {
return mSharedPreferences.getString(Constants.Pref.LANGUAGE, "");

View File

@ -215,8 +215,10 @@ 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 "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");
break;
}
case PASSPHRASE_EMPTY:

View File

@ -160,7 +160,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
message = getString(R.string.passphrase_for, userId);
break;
case DIVERT_TO_CARD:
message = getString(R.string.yubikey_pin);
message = getString(R.string.yubikey_pin, userId);
break;
default:
message = "This should not happen!";

@ -1 +1 @@
Subproject commit 14370a4b07922deec909472616c3df0d950d5614
Subproject commit d5871f13bd9e328ede389c65c20e541fb740121d