Add convenience method to unified keyrings to determine whether a keyring is expired, fix is_revoked for certain usages

This commit is contained in:
mar-v-in 2014-08-12 13:54:56 +02:00
parent 4fdf9ab486
commit 80674021b5
2 changed files with 5 additions and 1 deletions

View File

@ -105,8 +105,9 @@ public class KeychainContract {
public static class KeyRings implements BaseColumns, KeysColumns, UserIdsColumns {
public static final String MASTER_KEY_ID = KeysColumns.MASTER_KEY_ID;
public static final String IS_REVOKED = KeysColumns.IS_REVOKED;
public static final String IS_REVOKED = KeychainDatabase.Tables.KEYS + "." + KeysColumns.IS_REVOKED;
public static final String VERIFIED = CertsColumns.VERIFIED;
public static final String IS_EXPIRED = "is_expired";
public static final String HAS_ANY_SECRET = "has_any_secret";
public static final String HAS_ENCRYPT = "has_encrypt";
public static final String HAS_SIGN = "has_sign";

View File

@ -271,6 +271,9 @@ public class KeychainProvider extends ContentProvider {
"kE." + Keys.KEY_ID + " AS " + KeyRings.HAS_ENCRYPT);
projectionMap.put(KeyRings.HAS_SIGN,
"kS." + Keys.KEY_ID + " AS " + KeyRings.HAS_SIGN);
projectionMap.put(KeyRings.IS_EXPIRED,
"(" + Tables.KEYS + "." + Keys.EXPIRY + " < " + new Date().getTime() / 1000 + ") AS "
+ KeyRings.IS_EXPIRED);
qb.setProjectionMap(projectionMap);
// Need this as list so we can search in it