Revert "Add "Unlocked device required" parameter to keys"
This reverts commit efc3f16be7.
Reason for revert: Regression in creating auth-bound keys
Bug: 73773914
Bug: 67752510
Change-Id: Ic3886ceb3c3c0c4274682ed9f5f2bfbf8fdd71b9
This commit is contained in:
@@ -545,9 +545,7 @@ public class KeyStore {
|
||||
try {
|
||||
args = args != null ? args : new KeymasterArguments();
|
||||
entropy = entropy != null ? entropy : new byte[0];
|
||||
OperationResult res = mBinder.begin(getToken(), alias, purpose, pruneable, args, entropy, uid);
|
||||
// This result is -26 (KEY_USER_NOT_AUTHENTICATED) but why??
|
||||
return res;
|
||||
return mBinder.begin(getToken(), alias, purpose, pruneable, args, entropy, uid);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Cannot connect to keystore", e);
|
||||
return null;
|
||||
@@ -565,8 +563,7 @@ public class KeyStore {
|
||||
try {
|
||||
arguments = arguments != null ? arguments : new KeymasterArguments();
|
||||
input = input != null ? input : new byte[0];
|
||||
OperationResult res = mBinder.update(token, arguments, input);
|
||||
return res;
|
||||
return mBinder.update(token, arguments, input);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Cannot connect to keystore", e);
|
||||
return null;
|
||||
@@ -621,9 +618,9 @@ public class KeyStore {
|
||||
* @return {@code KeyStore.NO_ERROR} on success, otherwise an error value corresponding to
|
||||
* a {@code KeymasterDefs.KM_ERROR_} value or {@code KeyStore} ResponseCode.
|
||||
*/
|
||||
public int addAuthToken(byte[] authToken, int userId) {
|
||||
public int addAuthToken(byte[] authToken) {
|
||||
try {
|
||||
return mBinder.addAuthToken(authToken, userId);
|
||||
return mBinder.addAuthToken(authToken);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Cannot connect to keystore", e);
|
||||
return SYSTEM_ERROR;
|
||||
@@ -835,14 +832,14 @@ public class KeyStore {
|
||||
public InvalidKeyException getInvalidKeyException(
|
||||
String keystoreKeyAlias, int uid, KeyStoreException e) {
|
||||
switch (e.getErrorCode()) {
|
||||
case LOCKED: // 2
|
||||
case LOCKED:
|
||||
return new UserNotAuthenticatedException();
|
||||
case KeymasterDefs.KM_ERROR_KEY_EXPIRED: // -25
|
||||
case KeymasterDefs.KM_ERROR_KEY_EXPIRED:
|
||||
return new KeyExpiredException();
|
||||
case KeymasterDefs.KM_ERROR_KEY_NOT_YET_VALID: // -2
|
||||
case KeymasterDefs.KM_ERROR_KEY_NOT_YET_VALID:
|
||||
return new KeyNotYetValidException();
|
||||
case KeymasterDefs.KM_ERROR_KEY_USER_NOT_AUTHENTICATED: // -26
|
||||
case OP_AUTH_NEEDED: // 15
|
||||
case KeymasterDefs.KM_ERROR_KEY_USER_NOT_AUTHENTICATED:
|
||||
case OP_AUTH_NEEDED:
|
||||
{
|
||||
// We now need to determine whether the key/operation can become usable if user
|
||||
// authentication is performed, or whether it can never become usable again.
|
||||
@@ -882,7 +879,7 @@ public class KeyStore {
|
||||
// None of the key's SIDs can ever be authenticated
|
||||
return new KeyPermanentlyInvalidatedException();
|
||||
}
|
||||
case UNINITIALIZED: // 3
|
||||
case UNINITIALIZED:
|
||||
return new KeyPermanentlyInvalidatedException();
|
||||
default:
|
||||
return new InvalidKeyException("Keystore operation failed", e);
|
||||
|
||||
Reference in New Issue
Block a user