Merge "Keystore 2.0 SPI: Fix various CTS failures."
This commit is contained in:
@@ -190,7 +190,7 @@ public class KeyStoreSecurityLevel {
|
||||
keyDescriptor.blob = wrappedKey;
|
||||
keyDescriptor.domain = wrappedKeyDescriptor.domain;
|
||||
|
||||
return handleExceptions(() -> mSecurityLevel.importWrappedKey(wrappedKeyDescriptor,
|
||||
return handleExceptions(() -> mSecurityLevel.importWrappedKey(keyDescriptor,
|
||||
wrappingKeyDescriptor, maskingKey,
|
||||
args.toArray(new KeyParameter[args.size()]), authenticatorSpecs));
|
||||
}
|
||||
|
||||
@@ -163,6 +163,9 @@ public abstract class AndroidKeyStoreHmacSpi extends MacSpi implements KeyStoreC
|
||||
}
|
||||
|
||||
List<KeyParameter> parameters = new ArrayList<>();
|
||||
parameters.add(KeyStore2ParameterUtils.makeEnum(
|
||||
KeymasterDefs.KM_TAG_PURPOSE, KeymasterDefs.KM_PURPOSE_SIGN
|
||||
));
|
||||
parameters.add(KeyStore2ParameterUtils.makeEnum(
|
||||
KeymasterDefs.KM_TAG_ALGORITHM, KeymasterDefs.KM_ALGORITHM_HMAC
|
||||
));
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.security.KeyStoreSecurityLevel;
|
||||
import android.system.keystore2.Authorization;
|
||||
import android.system.keystore2.Domain;
|
||||
import android.system.keystore2.KeyDescriptor;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.Key;
|
||||
|
||||
@@ -127,15 +126,6 @@ public class AndroidKeyStoreKey implements Key {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the key ids are equal and the class matches all the other fields cannot differ
|
||||
// unless we have a bug.
|
||||
if (!mAlgorithm.equals(other.mAlgorithm)
|
||||
|| !mAuthorizations.equals(other.mAuthorizations)
|
||||
|| !mDescriptor.equals(other.mDescriptor)) {
|
||||
Log.e("AndroidKeyStoreKey", "Bug: key ids are identical, but key metadata"
|
||||
+ "differs.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -866,7 +866,8 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {
|
||||
try {
|
||||
response = mKeyStore.getKeyEntry(wrappingkey);
|
||||
} catch (android.security.KeyStoreException e) {
|
||||
throw new KeyStoreException("Failed to load wrapping key.", e);
|
||||
throw new KeyStoreException("Failed to import wrapped key. Keystore error code: "
|
||||
+ e.getErrorCode(), e);
|
||||
}
|
||||
|
||||
KeyDescriptor wrappedKey = makeKeyDescriptor(alias);
|
||||
|
||||
Reference in New Issue
Block a user