get rid of pin and pattern SecretKeyTypes

This commit is contained in:
Vincent Breitmoser 2017-05-28 22:26:56 +02:00
parent 27f6f4ef6c
commit e7b9b48d5c
7 changed files with 3 additions and 33 deletions

View file

@ -85,8 +85,6 @@ public class CertifyOperation extends BaseReadWriteOperation<CertifyActionsParce
Passphrase passphrase;
switch (cachedPublicKeyRing.getSecretKeyType(masterKeyId)) {
case PIN:
case PATTERN:
case PASSPHRASE:
passphrase = cryptoInput.getPassphrase();
if (passphrase == null) {

View file

@ -434,7 +434,6 @@ public abstract class OperationResult implements Parcelable {
MSG_IS_SUBKEY_STRIPPED (LogLevel.DEBUG, R.string.msg_is_subkey_stripped),
MSG_IS_SUBKEY_DIVERT (LogLevel.DEBUG, R.string.msg_is_subkey_divert),
MSG_IS_SUBKEY_EMPTY (LogLevel.DEBUG, R.string.msg_is_subkey_empty),
MSG_IS_SUBKEY_PIN (LogLevel.DEBUG, R.string.msg_is_subkey_pin),
MSG_IS_SUCCESS_IDENTICAL (LogLevel.OK, R.string.msg_is_success_identical),
MSG_IS_SUCCESS (LogLevel.OK, R.string.msg_is_success),

View file

@ -24,7 +24,6 @@ import java.security.PrivateKey;
import java.security.interfaces.ECPrivateKey;
import java.security.interfaces.RSAPrivateCrtKey;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.bouncycastle.bcpg.S2K;
@ -84,8 +83,7 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
}
public enum SecretKeyType {
UNAVAILABLE(0), GNU_DUMMY(1), PASSPHRASE(2), PASSPHRASE_EMPTY(3), DIVERT_TO_CARD(4), PIN(5),
PATTERN(6);
UNAVAILABLE(0), GNU_DUMMY(1), PASSPHRASE(2), PASSPHRASE_EMPTY(3), DIVERT_TO_CARD(4);
final int mNum;
@ -103,10 +101,6 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
return PASSPHRASE_EMPTY;
case 4:
return DIVERT_TO_CARD;
case 5:
return PIN;
case 6:
return PATTERN;
// if this case happens, it's probably a check from a database value
default:
return UNAVAILABLE;
@ -172,11 +166,6 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
// It means the passphrase is empty
return SecretKeyType.PASSPHRASE_EMPTY;
} catch (PGPException e) {
HashMap<String, String> notation = getRing().getLocalNotationData();
if (notation.containsKey("unlock.pin@sufficientlysecure.org")
&& "1".equals(notation.get("unlock.pin@sufficientlysecure.org"))) {
return SecretKeyType.PIN;
}
// Otherwise, it's just a regular ol' passphrase
return SecretKeyType.PASSPHRASE;
}

View file

@ -263,8 +263,6 @@ public class PgpSignEncryptOperation extends BaseOperation<PgpSignEncryptInputPa
break;
}
case PIN:
case PATTERN:
case PASSPHRASE: {
Passphrase localPassphrase = cryptoInput.getPassphrase();
if (localPassphrase == null) {

View file

@ -701,11 +701,6 @@ public class KeyWritableRepository extends KeyRepository {
KeyFormattingUtils.convertKeyIdToHex(id)
);
break;
case PIN:
log(LogType.MSG_IS_SUBKEY_PIN,
KeyFormattingUtils.convertKeyIdToHex(id)
);
break;
case GNU_DUMMY:
log(LogType.MSG_IS_SUBKEY_STRIPPED,
KeyFormattingUtils.convertKeyIdToHex(id)

View file

@ -57,9 +57,9 @@ import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeyRepository;
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
@ -252,10 +252,6 @@ public class PassphraseDialogActivity extends FragmentActivity {
message = getString(R.string.passphrase_for, userId);
hint = getString(R.string.label_passphrase);
break;
case PIN:
message = getString(R.string.pin_for, userId);
hint = getString(R.string.label_pin);
break;
case DIVERT_TO_CARD:
message = getString(R.string.security_token_pin_for, userId);
hint = getString(R.string.label_pin);
@ -290,11 +286,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
final ImageButton keyboard = (ImageButton) mLayout.findViewById(R.id.passphrase_keyboard);
if (keyType == CanonicalizedSecretKey.SecretKeyType.PIN) {
mPassphraseEditText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD);
mPassphraseEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
keyboard.setVisibility(View.GONE);
} else if (keyType == CanonicalizedSecretKey.SecretKeyType.DIVERT_TO_CARD) {
if (keyType == CanonicalizedSecretKey.SecretKeyType.DIVERT_TO_CARD) {
if (Preferences.getPreferences(activity).useNumKeypadForSecurityTokenPin()) {
setKeyboardNumeric(keyboard);
} else {

View file

@ -978,7 +978,6 @@
<string name="msg_is_subkey_nonexistent">"Subkey %s unavailable in secret key"</string>
<string name="msg_is_subkey_ok">"Marked secret subkey %s as available"</string>
<string name="msg_is_subkey_empty">"Marked secret subkey %s as available, with empty password"</string>
<string name="msg_is_subkey_pin">"Marked secret subkey %s as available, with PIN"</string>
<string name="msg_is_subkey_stripped">"Marked secret subkey %s as stripped"</string>
<string name="msg_is_subkey_divert">"Marked secret subkey %s as key on Security Token"</string>
<string name="msg_is_success_identical">"Keyring contains no new data, nothing to do"</string>