StorageHelper Class
- java.
lang. Object - com.
microsoft. aad. adal. StorageHelper
- com.
public class StorageHelper
Shared preferences store clear text. This class helps to encrypt/decrypt text to store. API SDK>= 18 has more security with AndroidKeyStore. Note: StorageHelper is designed for the ADAL internal encryption/decryption. Don't take dependency on it for external use.
Field Summary
Modifier and Type | Field and Description |
---|---|
final int |
DATA_KEY_LENGTH
IV Key length for AES-128. |
final int |
HMAC_LENGTH
256 bits output for signing message. |
final String |
VERSION_ANDROID_KEY_STORE
Indicate that token item is encrypted with the key persisted in AndroidKeyStore. |
final String |
VERSION_USER_DEFINED
Indicate that the token item is encrypted with the user provided key. |
Constructor Summary
Constructor | Description |
---|---|
StorageHelper(Context context) |
Constructor for StorageHelper. |
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
decrypt(final String encryptedBlob)
Decrypt encrypted blob with either user provided key or key persisted in AndroidKeyStore. |
String |
encrypt(final String clearText)
Encrypt text with current key based on API level. |
Field Details
DATA_KEY_LENGTH
public static final int DATA_KEY_LENGTH= 16
IV Key length for AES-128.
HMAC_LENGTH
public static final int HMAC_LENGTH= 32
256 bits output for signing message.
VERSION_ANDROID_KEY_STORE
public static final String VERSION_ANDROID_KEY_STORE= "A001"
Indicate that token item is encrypted with the key persisted in AndroidKeyStore.
VERSION_USER_DEFINED
public static final String VERSION_USER_DEFINED= "U001"
Indicate that the token item is encrypted with the user provided key.
Constructor Details
StorageHelper
Method Details
decrypt
public String decrypt(final String encryptedBlob)
Decrypt encrypted blob with either user provided key or key persisted in AndroidKeyStore.
Parameters:
Returns:
Throws:
encrypt
public String encrypt(final String clearText)
Encrypt text with current key based on API level.
Parameters:
Returns:
Throws:
Applies to
Azure SDK for Java
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for