MasterKey
public final class MasterKey
Wrapper for a master key used in the library.
On Android M (API 23) and above, this is class references a key that's stored in the Android Keystore. On Android L (API 21, 22), there isn't a master key.
Summary
Nested types |
|---|
public final class MasterKey.BuilderThis class is deprecated. Use |
public enum MasterKey.KeySchemeThis enum is deprecated. Use |
Constants |
|
|---|---|
static final int |
This field is deprecated. Use |
static final String |
DEFAULT_MASTER_KEY_ALIAS = "_androidx_security_master_key_"This field is deprecated. Use |
Public methods |
|
|---|---|
static int |
The default validity period for authentication in seconds. |
int |
Gets the duration in seconds that the key is unlocked for following user authentication. |
boolean |
Checks if this key is backed by the Android Keystore. |
boolean |
Gets whether the key is backed by strong box. |
boolean |
Gets whether user authentication is required to use this key. |
@NonNull String |
|
Constants
public static final int DEFAULT_AES_GCM_MASTER_KEY_SIZE = 256
The default and recommended size for the master key.
public static final String DEFAULT_MASTER_KEY_ALIAS = "_androidx_security_master_key_"
The default master key alias.
Public methods
public static int getDefaultAuthenticationValidityDurationSeconds()The default validity period for authentication in seconds.
public int getUserAuthenticationValidityDurationSeconds()Gets the duration in seconds that the key is unlocked for following user authentication.
The value returned for this method is only meaningful on Android M+ (API 23) when isUserAuthenticationRequired returns true.
| Returns | |
|---|---|
int |
The duration the key is unlocked for in seconds. |
public boolean isKeyStoreBacked()Checks if this key is backed by the Android Keystore.
| Returns | |
|---|---|
boolean |
|
public boolean isUserAuthenticationRequired()Gets whether user authentication is required to use this key.
This method always returns false on Android L (API 21 + 22).