com.microsoft.aad.adal
Class StorageHelper
java.lang.Object
com.microsoft.aad.adal.StorageHelper
public class StorageHelper
- extends Object
Shared preferences store clear text. This class helps to encrypt/decrypt text
to store. API SDK >= 18 has more security with AndroidKeyStore.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DATA_KEY_LENGTH
public static final int DATA_KEY_LENGTH
- IV Key length for AES-128.
- See Also:
- Constant Field Values
MAC_LENGTH
public static final int MAC_LENGTH
- 256 bits output for signing message.
- See Also:
- Constant Field Values
VERSION_ANDROID_KEY_STORE
public static final String VERSION_ANDROID_KEY_STORE
- See Also:
- Constant Field Values
VERSION_USER_DEFINED
public static final String VERSION_USER_DEFINED
- See Also:
- Constant Field Values
StorageHelper
public StorageHelper(android.content.Context ctx)
throws NoSuchAlgorithmException,
NoSuchPaddingException
- Throws:
NoSuchAlgorithmException
NoSuchPaddingException
encrypt
public String encrypt(String clearText)
throws NoSuchAlgorithmException,
InvalidKeySpecException,
InvalidKeyException,
InvalidAlgorithmParameterException,
IllegalBlockSizeException,
BadPaddingException,
IOException,
NoSuchPaddingException
- encrypt text with current key based on API level
- Parameters:
clearText -
- Returns:
-
- Throws:
NoSuchAlgorithmException
InvalidKeySpecException
InvalidKeyException
InvalidAlgorithmParameterException
IllegalBlockSizeException
BadPaddingException
IOException
NoSuchPaddingException
decrypt
public String decrypt(String value)
throws NoSuchAlgorithmException,
InvalidKeySpecException,
NoSuchPaddingException,
KeyStoreException,
CertificateException,
NoSuchProviderException,
InvalidAlgorithmParameterException,
UnrecoverableEntryException,
IOException,
InvalidKeyException,
DigestException,
IllegalBlockSizeException,
BadPaddingException
- Throws:
NoSuchAlgorithmException
InvalidKeySpecException
NoSuchPaddingException
KeyStoreException
CertificateException
NoSuchProviderException
InvalidAlgorithmParameterException
UnrecoverableEntryException
IOException
InvalidKeyException
DigestException
IllegalBlockSizeException
BadPaddingException
Copyright © 2003–2015. All rights reserved.