Handle revoked and expired keys in decrypt activity

This commit is contained in:
Dominik Schürmann 2014-10-08 17:39:53 +02:00
parent 158f22a799
commit 2eb776594f
15 changed files with 55 additions and 31 deletions

View File

@ -86,6 +86,13 @@ public abstract class DecryptFragment extends Fragment {
startActivityForResult(intent, RESULT_CODE_LOOKUP_KEY);
}
private void showKey(long keyId) {
Intent viewKeyIntent = new Intent(getActivity(), ViewKeyActivity.class);
viewKeyIntent.setData(KeychainContract.KeyRings
.buildGenericKeyRingUri(keyId));
startActivity(viewKeyIntent);
}
protected void startPassphraseDialog(long subkeyId) {
Intent intent = new Intent(getActivity(), PassphraseDialogActivity.class);
intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, subkeyId);
@ -145,10 +152,7 @@ public abstract class DecryptFragment extends Fragment {
mSignatureLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent viewKeyIntent = new Intent(getActivity(), ViewKeyActivity.class);
viewKeyIntent.setData(KeychainContract.KeyRings
.buildGenericKeyRingUri(mSignatureKeyId));
startActivity(viewKeyIntent);
showKey(mSignatureKeyId);
}
});
break;
@ -159,22 +163,30 @@ public abstract class DecryptFragment extends Fragment {
KeyFormattingUtils.setStatusImage(getActivity(), mSignatureIcon, mSignatureText, KeyFormattingUtils.STATE_UNVERIFIED);
setSignatureLayoutVisibility(View.VISIBLE);
mSignatureAction.setText(R.string.decrypt_result_action_show);
mSignatureAction.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_accounts, 0);
mSignatureLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent viewKeyIntent = new Intent(getActivity(), ViewKeyActivity.class);
viewKeyIntent.setData(KeychainContract.KeyRings
.buildGenericKeyRingUri(mSignatureKeyId));
startActivity(viewKeyIntent);
}
});
setShowAction(mSignatureAction, mSignatureKeyId);
break;
}
case OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED: {
mSignatureText.setText(R.string.decrypt_result_signature_expired_key);
KeyFormattingUtils.setStatusImage(getActivity(), mSignatureIcon, mSignatureText, KeyFormattingUtils.STATE_EXPIRED);
setSignatureLayoutVisibility(View.VISIBLE);
setShowAction(mSignatureAction, mSignatureKeyId);
break;
}
case OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED: {
mSignatureText.setText(R.string.decrypt_result_signature_revoked_key);
KeyFormattingUtils.setStatusImage(getActivity(), mSignatureIcon, mSignatureText, KeyFormattingUtils.STATE_REVOKED);
setSignatureLayoutVisibility(View.VISIBLE);
setShowAction(mSignatureAction, mSignatureKeyId);
break;
}
case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: {
mSignatureText.setText(R.string.decrypt_result_signature_unknown_pub_key);
mSignatureText.setText(R.string.decrypt_result_signature_missing_key);
KeyFormattingUtils.setStatusImage(getActivity(), mSignatureIcon, mSignatureText, KeyFormattingUtils.STATE_UNKNOWN_KEY);
setSignatureLayoutVisibility(View.VISIBLE);
@ -189,7 +201,6 @@ public abstract class DecryptFragment extends Fragment {
break;
}
// TODO: Maybe this should be part of the Result parcel, it is an error, not a valid status!
case OpenPgpSignatureResult.SIGNATURE_ERROR: {
mSignatureText.setText(R.string.decrypt_result_invalid_signature);
KeyFormattingUtils.setStatusImage(getActivity(), mSignatureIcon, mSignatureText, KeyFormattingUtils.STATE_INVALID);
@ -214,6 +225,17 @@ public abstract class DecryptFragment extends Fragment {
mSignatureDivider2.setVisibility(visibility);
}
private void setShowAction(TextView signatureAction, final long signatureKeyId) {
signatureAction.setText(R.string.decrypt_result_action_show);
signatureAction.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_accounts, 0);
signatureAction.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showKey(signatureKeyId);
}
});
}
/**
* Should be overridden by MessageFragment and FileFragment to start actual decryption
*/

View File

@ -229,7 +229,7 @@
<string name="error_generic_report_bug">Nastala obecná chyba, prosím vytvořte nový bug report pro OpenKeychain.</string>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Špatný podpis!</string>
<string name="decrypt_result_signature_unknown_pub_key">Neznámý veřejný klíč</string>
<string name="decrypt_result_signature_missing_key">Neznámý veřejný klíč</string>
<string name="decrypt_result_signature_uncertified">Validní podpis (neověřen)</string>
<string name="decrypt_result_signature_certified">Validní podpis (ověřen)</string>
<string name="decrypt_result_decrypted">Úspěšně rozšifrováno</string>

View File

@ -246,7 +246,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Ungültige Signatur!</string>
<string name="decrypt_result_signature_unknown_pub_key">Unbekannter öffentlicher Schlüssel</string>
<string name="decrypt_result_signature_missing_key">Unbekannter öffentlicher Schlüssel</string>
<string name="decrypt_result_signature_uncertified">Gültige Signatur (nicht beglaubigt)</string>
<string name="decrypt_result_signature_certified">Gültige Signatur (beglaubigt)</string>
<string name="decrypt_result_decrypted">Erfolgreich entschlüsselt</string>

View File

@ -238,7 +238,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">¡Firma no válida!</string>
<string name="decrypt_result_signature_unknown_pub_key">Clave pública desconocida</string>
<string name="decrypt_result_signature_missing_key">Clave pública desconocida</string>
<string name="decrypt_result_signature_uncertified">Firma válida (no certificada)</string>
<string name="decrypt_result_signature_certified">Firma válida (certificada)</string>
<string name="decrypt_result_decrypted">Descifrado con éxito</string>

View File

@ -238,7 +238,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Signature invalide !</string>
<string name="decrypt_result_signature_unknown_pub_key">Clef publique inconnue</string>
<string name="decrypt_result_signature_missing_key">Clef publique inconnue</string>
<string name="decrypt_result_signature_uncertified">Signature valide (non certifiée)</string>
<string name="decrypt_result_signature_certified">Signature valide (certifiée)</string>
<string name="decrypt_result_decrypted">Déchiffré avec succès</string>

View File

@ -245,7 +245,7 @@ Non potrai annullare!</string>
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Firma non valida!</string>
<string name="decrypt_result_signature_unknown_pub_key">Chiave pubblica sconosciuta</string>
<string name="decrypt_result_signature_missing_key">Chiave pubblica sconosciuta</string>
<string name="decrypt_result_signature_uncertified">Firma valida (non certificata)</string>
<string name="decrypt_result_signature_certified">Firma valida (certificata)</string>
<string name="decrypt_result_decrypted">Decodificato correttamente</string>

View File

@ -254,7 +254,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">不正な署名です!</string>
<string name="decrypt_result_signature_unknown_pub_key">不明な公開鍵</string>
<string name="decrypt_result_signature_missing_key">不明な公開鍵</string>
<string name="decrypt_result_signature_uncertified">正しい署名 (未証明)</string>
<string name="decrypt_result_signature_certified">正しい署名 (証明ずみ)</string>
<string name="decrypt_result_decrypted">復号化に成功した</string>

View File

@ -174,7 +174,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Ongeldige handtekening!</string>
<string name="decrypt_result_signature_unknown_pub_key">Onbekende publieke sleutel</string>
<string name="decrypt_result_signature_missing_key">Onbekende publieke sleutel</string>
<string name="decrypt_result_signature_uncertified">Geldige handtekening (ongecertificeerd)</string>
<string name="decrypt_result_signature_certified">Geldige handtekening (gecertificeerd)</string>
<string name="decrypt_result_decrypted">Succesvol gedecodeerd</string>

View File

@ -161,7 +161,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Nieprawidłowy podpis!</string>
<string name="decrypt_result_signature_unknown_pub_key">Nieznany klucz publiczny</string>
<string name="decrypt_result_signature_missing_key">Nieznany klucz publiczny</string>
<string name="decrypt_result_signature_uncertified">Podpis prawidłowy (bez certyfikatu)</string>
<string name="decrypt_result_signature_certified">Podpis prawidłowy (z certyfikatem)</string>
<string name="decrypt_result_decrypted">Odszyfrowano pomyślnie</string>

View File

@ -209,7 +209,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Неверная подпись!</string>
<string name="decrypt_result_signature_unknown_pub_key">Неизвестный ключ</string>
<string name="decrypt_result_signature_missing_key">Неизвестный ключ</string>
<string name="decrypt_result_signature_uncertified">Верная подпись (не сертифицирована)</string>
<string name="decrypt_result_signature_certified">Верная подпись (сертифицирована)</string>
<string name="decrypt_result_decrypted">Успешно расшифровано</string>

View File

@ -226,7 +226,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Neveljaven podpis!</string>
<string name="decrypt_result_signature_unknown_pub_key">Neznan javni ključ</string>
<string name="decrypt_result_signature_missing_key">Neznan javni ključ</string>
<string name="decrypt_result_signature_uncertified">Veljaven podpis (neoverjen)</string>
<string name="decrypt_result_signature_certified">Veljaven podpis (overjen)</string>
<string name="decrypt_result_decrypted">Uspešno dešifrirano</string>

View File

@ -231,7 +231,7 @@
<string name="error_generic_report_bug">Дошло је до опште грешке, направите нови извештај о грешци за Отворени кључарник.</string>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Неисправан потпис!</string>
<string name="decrypt_result_signature_unknown_pub_key">Непознат јавни кључ</string>
<string name="decrypt_result_signature_missing_key">Непознат јавни кључ</string>
<string name="decrypt_result_signature_uncertified">Исправан потпис (неоверен)</string>
<string name="decrypt_result_signature_certified">Исправан потпис (оверен)</string>
<string name="decrypt_result_decrypted">Успешно дешифровано</string>

View File

@ -214,7 +214,7 @@
<string name="error_generic_report_bug">Genel bir hata oluştu. Lütfen OpenKeychain için bir hata raporu oluşturun.</string>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Geçersiz imza!</string>
<string name="decrypt_result_signature_unknown_pub_key">Bilinmeyen açık anahtar</string>
<string name="decrypt_result_signature_missing_key">Bilinmeyen açık anahtar</string>
<string name="decrypt_result_signature_uncertified">Geçerli imza (sertifikasız)</string>
<string name="decrypt_result_signature_certified">Geçerli imza (sertifalı)</string>
<string name="decrypt_result_decrypted">Başarıyla çözümlendi</string>

View File

@ -208,7 +208,7 @@
</plurals>
<!--results shown after decryption/verification-->
<string name="decrypt_result_invalid_signature">Невірний підпис!</string>
<string name="decrypt_result_signature_unknown_pub_key">Невідомий відкритий ключ</string>
<string name="decrypt_result_signature_missing_key">Невідомий відкритий ключ</string>
<string name="decrypt_result_signature_uncertified">Дійсний підпис (несертифікований)</string>
<string name="decrypt_result_signature_certified">Дійсний підпис (сертифікований)</string>
<string name="decrypt_result_decrypted">Успішно розшифровано.</string>

View File

@ -268,9 +268,11 @@
<!-- results shown after decryption/verification -->
<string name="decrypt_result_no_signature">"Not Signed"</string>
<string name="decrypt_result_invalid_signature">"Invalid signature!"</string>
<string name="decrypt_result_signature_unknown_pub_key">"Unknown public key"</string>
<string name="decrypt_result_signature_uncertified">"Signed by (not certified!)"</string>
<string name="decrypt_result_signature_certified">"Signed by"</string>
<string name="decrypt_result_signature_expired_key">"Key is expired!"</string>
<string name="decrypt_result_signature_revoked_key">"Key has been revoked!"</string>
<string name="decrypt_result_signature_missing_key">"Unknown public key"</string>
<string name="decrypt_result_encrypted">"Encrypted"</string>
<string name="decrypt_result_not_encrypted">"Not Encrypted"</string>
<string name="decrypt_result_action_show">"Show"</string>