get rid of pin and pattern SecretKeyTypes
This commit is contained in:
@@ -85,8 +85,6 @@ public class CertifyOperation extends BaseReadWriteOperation<CertifyActionsParce
|
|||||||
Passphrase passphrase;
|
Passphrase passphrase;
|
||||||
|
|
||||||
switch (cachedPublicKeyRing.getSecretKeyType(masterKeyId)) {
|
switch (cachedPublicKeyRing.getSecretKeyType(masterKeyId)) {
|
||||||
case PIN:
|
|
||||||
case PATTERN:
|
|
||||||
case PASSPHRASE:
|
case PASSPHRASE:
|
||||||
passphrase = cryptoInput.getPassphrase();
|
passphrase = cryptoInput.getPassphrase();
|
||||||
if (passphrase == null) {
|
if (passphrase == null) {
|
||||||
|
|||||||
@@ -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_STRIPPED (LogLevel.DEBUG, R.string.msg_is_subkey_stripped),
|
||||||
MSG_IS_SUBKEY_DIVERT (LogLevel.DEBUG, R.string.msg_is_subkey_divert),
|
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_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_IDENTICAL (LogLevel.OK, R.string.msg_is_success_identical),
|
||||||
MSG_IS_SUCCESS (LogLevel.OK, R.string.msg_is_success),
|
MSG_IS_SUCCESS (LogLevel.OK, R.string.msg_is_success),
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import java.security.PrivateKey;
|
|||||||
import java.security.interfaces.ECPrivateKey;
|
import java.security.interfaces.ECPrivateKey;
|
||||||
import java.security.interfaces.RSAPrivateCrtKey;
|
import java.security.interfaces.RSAPrivateCrtKey;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.S2K;
|
import org.bouncycastle.bcpg.S2K;
|
||||||
@@ -84,8 +83,7 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum SecretKeyType {
|
public enum SecretKeyType {
|
||||||
UNAVAILABLE(0), GNU_DUMMY(1), PASSPHRASE(2), PASSPHRASE_EMPTY(3), DIVERT_TO_CARD(4), PIN(5),
|
UNAVAILABLE(0), GNU_DUMMY(1), PASSPHRASE(2), PASSPHRASE_EMPTY(3), DIVERT_TO_CARD(4);
|
||||||
PATTERN(6);
|
|
||||||
|
|
||||||
final int mNum;
|
final int mNum;
|
||||||
|
|
||||||
@@ -103,10 +101,6 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
|
|||||||
return PASSPHRASE_EMPTY;
|
return PASSPHRASE_EMPTY;
|
||||||
case 4:
|
case 4:
|
||||||
return DIVERT_TO_CARD;
|
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
|
// if this case happens, it's probably a check from a database value
|
||||||
default:
|
default:
|
||||||
return UNAVAILABLE;
|
return UNAVAILABLE;
|
||||||
@@ -172,11 +166,6 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
|
|||||||
// It means the passphrase is empty
|
// It means the passphrase is empty
|
||||||
return SecretKeyType.PASSPHRASE_EMPTY;
|
return SecretKeyType.PASSPHRASE_EMPTY;
|
||||||
} catch (PGPException e) {
|
} 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
|
// Otherwise, it's just a regular ol' passphrase
|
||||||
return SecretKeyType.PASSPHRASE;
|
return SecretKeyType.PASSPHRASE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,8 +263,6 @@ public class PgpSignEncryptOperation extends BaseOperation<PgpSignEncryptInputPa
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PIN:
|
|
||||||
case PATTERN:
|
|
||||||
case PASSPHRASE: {
|
case PASSPHRASE: {
|
||||||
Passphrase localPassphrase = cryptoInput.getPassphrase();
|
Passphrase localPassphrase = cryptoInput.getPassphrase();
|
||||||
if (localPassphrase == null) {
|
if (localPassphrase == null) {
|
||||||
|
|||||||
@@ -701,11 +701,6 @@ public class KeyWritableRepository extends KeyRepository {
|
|||||||
KeyFormattingUtils.convertKeyIdToHex(id)
|
KeyFormattingUtils.convertKeyIdToHex(id)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case PIN:
|
|
||||||
log(LogType.MSG_IS_SUBKEY_PIN,
|
|
||||||
KeyFormattingUtils.convertKeyIdToHex(id)
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case GNU_DUMMY:
|
case GNU_DUMMY:
|
||||||
log(LogType.MSG_IS_SUBKEY_STRIPPED,
|
log(LogType.MSG_IS_SUBKEY_STRIPPED,
|
||||||
KeyFormattingUtils.convertKeyIdToHex(id)
|
KeyFormattingUtils.convertKeyIdToHex(id)
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ import org.sufficientlysecure.keychain.pgp.KeyRing;
|
|||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
|
||||||
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
||||||
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
|
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
|
||||||
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||||
@@ -252,10 +252,6 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
message = getString(R.string.passphrase_for, userId);
|
message = getString(R.string.passphrase_for, userId);
|
||||||
hint = getString(R.string.label_passphrase);
|
hint = getString(R.string.label_passphrase);
|
||||||
break;
|
break;
|
||||||
case PIN:
|
|
||||||
message = getString(R.string.pin_for, userId);
|
|
||||||
hint = getString(R.string.label_pin);
|
|
||||||
break;
|
|
||||||
case DIVERT_TO_CARD:
|
case DIVERT_TO_CARD:
|
||||||
message = getString(R.string.security_token_pin_for, userId);
|
message = getString(R.string.security_token_pin_for, userId);
|
||||||
hint = getString(R.string.label_pin);
|
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);
|
final ImageButton keyboard = (ImageButton) mLayout.findViewById(R.id.passphrase_keyboard);
|
||||||
|
|
||||||
if (keyType == CanonicalizedSecretKey.SecretKeyType.PIN) {
|
if (keyType == CanonicalizedSecretKey.SecretKeyType.DIVERT_TO_CARD) {
|
||||||
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 (Preferences.getPreferences(activity).useNumKeypadForSecurityTokenPin()) {
|
if (Preferences.getPreferences(activity).useNumKeypadForSecurityTokenPin()) {
|
||||||
setKeyboardNumeric(keyboard);
|
setKeyboardNumeric(keyboard);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -978,7 +978,6 @@
|
|||||||
<string name="msg_is_subkey_nonexistent">"Subkey %s unavailable in secret key"</string>
|
<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_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_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_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_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>
|
<string name="msg_is_success_identical">"Keyring contains no new data, nothing to do"</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user