Symmetric key generation for AndroidKeyStore.

This currently supports AES and HMAC with SHA-256.

Bug: 18088752
Change-Id: Ife55438cf4129b895295681bb35091cd37eb73fb
This commit is contained in:
Alex Klyubin
2015-03-27 14:39:28 -07:00
parent dbd9a4b651
commit d23a1f706f
8 changed files with 814 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package android.security;
import android.security.keymaster.KeymasterDefs;
/**
* @hide
*/
public abstract class KeymasterUtils {
private KeymasterUtils() {}
public static KeymasterException getExceptionForKeymasterError(int keymasterErrorCode) {
switch (keymasterErrorCode) {
case KeymasterDefs.KM_ERROR_INVALID_AUTHORIZATION_TIMEOUT:
// The name of this parameter significantly differs between Keymaster and framework
// APIs. Use the framework wording to make life easier for developers.
return new KeymasterException("Invalid user authentication validity duration");
default:
return new KeymasterException(KeymasterDefs.getErrorMessage(keymasterErrorCode));
}
}
}