In package de.adorsys.android.securestorage2
class de.adorsys.android.securestorage2.SecureStorage
Methods
fun init(context: , encryptionKeyAlias: String?, x500Principal: String?, useOnlyWithHardwareSupport: Boolean)
Initialize the library with desired options
-
context:
Context is used internally
-
encryptionKeyAlias: String?
Alias for the encryption key/keypair (default value: SecureStorage2Key)
-
x500Principal: String?
Distinguished Name used for generating KeyPair for asymmetric en/decryption (default value: CN=SecureStorage2 , O=Adorsys GmbH & Co. KG., C=Germany)
-
useOnlyWithHardwareSupport: Boolean
If this parameter is true the library will only work on devices that have a TEE or SE otherwise it'ss throw an exception
fun initSecureStorageKeys(context: )
Initialize SecureStorage keys for library usage.
-
context:
Context is used internally
fun deviceHasSecureHardwareSupport(context: ): Boolean
Checks if the device has secure hardware support (TEE or SE) for storing the Android Keystore keys
-
context:
Context is used internally
fun isKeyInsideSecureHardware()
Checks if the keys are stored in secure hardware (TEE or SE)
- No parameters
fun putString(context: , key: String, value: String)
Takes plain string value, encrypts it and stores it encrypted in the SecureStorage on the Android Device
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
value: String
Plain String value that will be encrypted and stored in the SecureStorage
fun putBoolean(context: , key: String, value: Boolean)
Takes plain string value, encrypts it and stores it encrypted in the SecureStorage on the Android Device
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
value: Boolean
Plain boolean value that will be encrypted and stored in the SecureStorage
fun putFloat(context: , key: String, value: Float)
Takes plain string value, encrypts it and stores it encrypted in the SecureStorage on the Android Device
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
value: Float
Plain float value that will be encrypted and stored in the SecureStorage
fun putLong(context: , key: String, value: Long)
Takes plain string value, encrypts it and stores it encrypted in the SecureStorage on the Android Device
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
value: Long
Plain long value that will be encrypted and stored in the SecureStorage
fun putInt(context: , key: String, value: Int)
Takes plain string value, encrypts it and stores it encrypted in the SecureStorage on the Android Device
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
value: Int
Plain int value that will be encrypted and stored in the SecureStorage
fun getString(context: , key: String, defaultValue: String): String
Gets encrypted String value for given key from the SecureStorage on the Android Device, decrypts it and returns it
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
defaultValue: String
Default String value that will be returned if the value with given key doesn't exist or an exception is thrown
fun getBoolean(context: , key: String, defaultValue: Boolean): Boolean
Gets encrypted boolean value for given key from the SecureStorage on the Android Device, decrypts it and returns it
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
defaultValue: Boolean
Default boolean value that will be returned if the value with given key doesn't exist or an exception is thrown
fun getFloat(context: , key: String, defaultValue: Float): Float
Gets encrypted float value for given key from the SecureStorage on the Android Device, decrypts it and returns it
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
defaultValue: Float
Default float value that will be returned if the value with given key doesn't exist or an exception is thrown
fun getLong(context: , key: String, defaultValue: Long): Long
Gets encrypted long value for given key from the SecureStorage on the Android Device, decrypts it and returns it
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
defaultValue: Long
Default long value that will be returned if the value with given key doesn't exist or an exception is thrown
fun getInt(context: , key: String, defaultValue: Int): Int
Gets encrypted int value for given key from the SecureStorage on the Android Device, decrypts it and returns it
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
-
defaultValue: Int
Default int value that will be returned if the value with given key doesn't exist or an exception is thrown
fun contains(context: , key: String): Boolean
Checks if SecureStorage contains a value for the given key (Does not return the value or check what type it is)
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
fun remove(context: , key: String)
Removes the value for a given key from SecureStorage
-
context:
Context is used internally
-
key: String
Key used to identify the stored value in SecureStorage
fun clearAllValues(context: )
Clears all values from the SecureStorage on the Android Device
-
context:
Context is used internally
fun clearAllValuesAndDeleteKeys(context: )
Clears all values from the SecureStorage on the Android Device and deletes the en/decryption keys Means new keys/keypairs have to be generated for the library to be able to work
-
context:
Context is used internally
fun registerOnSecureStorageChangeListener(context: , listener: )
Registers SecureStorageChangeListener to listen to any changes in SecureStorage
-
context:
Context is used internally
-
listener:
Provided listener with given behaviour from the developer that will be registered
fun unregisterOnSecureStorageChangeListener(context: , listener: )
Unregisters SecureStorageChangeListener from SecureStorage
-
context:
Context is used internally
-
listener:
Provided listener with given behaviour from the developer that will be unregistered