Add sshauthentication-api v1 support
This commit is contained in:
@@ -201,6 +201,27 @@ public class CachedPublicKeyRing extends KeyRing {
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the key id which should be used for authentication.
|
||||
*
|
||||
* This method returns keys which are actually available (ie. secret available, and not stripped,
|
||||
* revoked, or expired), hence only works on keyrings where a secret key is available!
|
||||
*
|
||||
*/
|
||||
public long getSecretAuthenticationId() throws PgpKeyNotFoundException {
|
||||
try {
|
||||
Object data = mKeyRepository.getGenericData(mUri,
|
||||
KeyRings.HAS_AUTHENTICATE,
|
||||
KeyRepository.FIELD_TYPE_INTEGER);
|
||||
return (Long) data;
|
||||
} catch(KeyWritableRepository.NotFoundException e) {
|
||||
throw new PgpKeyNotFoundException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAuthentication() throws PgpKeyNotFoundException {
|
||||
return getSecretAuthenticationId() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVerified() throws PgpKeyNotFoundException {
|
||||
try {
|
||||
|
||||
@@ -355,6 +355,8 @@ 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.HAS_AUTHENTICATE,
|
||||
"kA." + Keys.KEY_ID + " AS " + KeyRings.HAS_AUTHENTICATE);
|
||||
projectionMap.put(KeyRings.HAS_CERTIFY,
|
||||
"kC." + Keys.KEY_ID + " AS " + KeyRings.HAS_CERTIFY);
|
||||
projectionMap.put(KeyRings.IS_EXPIRED,
|
||||
|
||||
Reference in New Issue
Block a user