-
Notifications
You must be signed in to change notification settings - Fork 3
MasterKeyHandler
Victor Bieszka edited this page Mar 18, 2019
·
1 revision
public class MasterKeyHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MASTER_KEY_LEN_BITS_PRE |
Constructor and Description |
---|
MasterKeyHandler() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertMasterKeyAsString(byte[] masterKey)
Converts the byte array master key to a comma-separated string.
|
static byte[] |
convertMasterKeyString(java.lang.String sMasterKey)
Converts a prior converted master key as String to a byte array.
|
static byte[] |
getMasterKey(android.content.Context context)
Returns the plib-depended initially randomly generated master key.
|
static byte[] |
replaceMasterKey(android.content.Context context)
Replaces the current master key with a new securly randomly generated one.
|
static byte[] |
replaceMasterKey(android.content.Context context,
byte[] newMasterKey)
Replaces the current master key.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait
-
public static final int MASTER_KEY_LEN_BITS_PRE
- See Also:
- Constant Field Values
-
public MasterKeyHandler()
-
public static byte[] getMasterKey(android.content.Context context)
Returns the plib-depended initially randomly generated master key. In dependency of this master key, all other keys, seeds, ... have to be generated in a deterministic way.- Parameters:
-
context
- - Returns:
- the master key in form of a
byte[]
public static byte[] replaceMasterKey(android.content.Context context, byte[] newMasterKey)
Replaces the current master key. This is the only situation, where the old master key is
accessible for different usages like encryption of old files...
- Parameters:
-
context
- -
newMasterKey
- the new master key - Returns:
- the old master key
public static byte[] replaceMasterKey(android.content.Context context)
Replaces the current master key with a new securly randomly generated one. This is the only
situation, where the old master key is accessible for different usages like encryption of old
files...
- Parameters:
-
context
- - Returns:
- the old master key
-
public static byte[] convertMasterKeyString(java.lang.String sMasterKey)
Converts a prior converted master key as String to a byte array. This operation will fail if the last entry of the string code not the current master key version number or if the coded size is different to what is expected. In the case of a failed operation,null
will be returned.- Parameters:
-
sMasterKey
- - Returns:
-
public static java.lang.String convertMasterKeyAsString(byte[] masterKey)
Converts the byte array master key to a comma-separated string. The last entry is a master key version identifier which is not part of the master key itself.- Parameters:
-
masterKey
- the master key - Returns: