support partially bound tokens in key health view

This commit is contained in:
Vincent Breitmoser
2017-09-28 17:27:52 +02:00
parent 77856afc4f
commit 7ee41aa51c
3 changed files with 22 additions and 7 deletions

View File

@@ -172,18 +172,26 @@ public class KeyHealthPresenter implements LoaderCallbacks<KeySubkeyStatus> {
return KeyHealthStatus.STRIPPED;
}
if (keyCertify.mSecretKeyType == SecretKeyType.GNU_DUMMY
|| keySign.mSecretKeyType == SecretKeyType.GNU_DUMMY
|| keyEncrypt.mSecretKeyType == SecretKeyType.GNU_DUMMY) {
return KeyHealthStatus.PARTIAL_STRIPPED;
}
if (keyCertify.mSecretKeyType == SecretKeyType.DIVERT_TO_CARD
&& keySign.mSecretKeyType == SecretKeyType.DIVERT_TO_CARD
&& keyEncrypt.mSecretKeyType == SecretKeyType.DIVERT_TO_CARD) {
return KeyHealthStatus.DIVERT;
}
boolean containsDivertKeys = keyCertify.mSecretKeyType == SecretKeyType.DIVERT_TO_CARD ||
keySign.mSecretKeyType == SecretKeyType.DIVERT_TO_CARD ||
keyEncrypt.mSecretKeyType == SecretKeyType.DIVERT_TO_CARD;
if (containsDivertKeys) {
return KeyHealthStatus.DIVERT_PARTIAL;
}
boolean containsStrippedKeys = keyCertify.mSecretKeyType == SecretKeyType.GNU_DUMMY
|| keySign.mSecretKeyType == SecretKeyType.GNU_DUMMY
|| keyEncrypt.mSecretKeyType == SecretKeyType.GNU_DUMMY;
if (containsStrippedKeys) {
return KeyHealthStatus.PARTIAL_STRIPPED;
}
return KeyHealthStatus.OK;
}
@@ -255,7 +263,7 @@ public class KeyHealthPresenter implements LoaderCallbacks<KeySubkeyStatus> {
}
public enum KeyHealthStatus {
OK, DIVERT, REVOKED, EXPIRED, INSECURE, SIGN_ONLY, STRIPPED, PARTIAL_STRIPPED, BROKEN
OK, DIVERT, DIVERT_PARTIAL, REVOKED, EXPIRED, INSECURE, SIGN_ONLY, STRIPPED, PARTIAL_STRIPPED, BROKEN
}
public interface KeyHealthMvpView {

View File

@@ -92,6 +92,8 @@ public class KeyHealthView extends LinearLayout implements KeyHealthMvpView, OnC
R.drawable.ic_check_black_24dp, R.color.android_green_light),
DIVERT (R.string.key_health_divert_title, R.string.key_health_divert_subtitle,
R.drawable.yubi_icon_24dp, R.color.md_black_1000),
DIVERT_PARTIAL (R.string.key_health_divert_partial_title, R.string.key_health_divert_partial_subtitle,
R.drawable.yubi_icon_24dp, R.color.md_black_1000),
REVOKED (R.string.key_health_revoked_title, R.string.key_health_revoked_subtitle,
R.drawable.ic_close_black_24dp, R.color.android_red_light),
EXPIRED (R.string.key_health_expired_title, R.string.key_health_expired_subtitle,
@@ -132,6 +134,9 @@ public class KeyHealthView extends LinearLayout implements KeyHealthMvpView, OnC
case DIVERT:
setKeyStatus(KeyHealthDisplayStatus.DIVERT);
break;
case DIVERT_PARTIAL:
setKeyStatus(KeyHealthDisplayStatus.DIVERT_PARTIAL);
break;
case REVOKED:
setKeyStatus(KeyHealthDisplayStatus.REVOKED);
break;

View File

@@ -1821,6 +1821,8 @@
<string name="key_health_ok_subtitle">"No key issues found."</string>
<string name="key_health_divert_title">"Healthy (Security Token)"</string>
<string name="key_health_divert_subtitle">"No key issues found."</string>
<string name="key_health_divert_partial_title">"Healthy (Partial Token)"</string>
<string name="key_health_divert_partial_subtitle">"Click for details"</string>
<string name="key_health_expired_title">"Expired"</string>
<string name="key_health_expired_subtitle">"This key should not be used anymore."</string>
<string name="key_health_revoked_title">"Revoked"</string>