Skip to content

MasterKeyHandler

Victor Bieszka edited this page Mar 18, 2019 · 1 revision

Class MasterKeyHandler

public class MasterKeyHandler
extends java.lang.Object

Field Summary

 
Modifier and Type Field and Description
static int MASTER_KEY_LEN_BITS_PRE 

Constructor Summary

 
Constructor and Description
MasterKeyHandler() 

Method Summary

   
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.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait

Field Detail

  • MASTER_KEY_LEN_BITS_PRE

    public static final int MASTER_KEY_LEN_BITS_PRE
    See Also:
    Constant Field Values

Constructor Detail

  • MasterKeyHandler

    public MasterKeyHandler()

Method Detail

  • getMasterKey

    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[]

replaceMasterKey

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
  • convertMasterKeyString

    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:
  • convertMasterKeyAsString

    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:
Clone this wiki locally