Package com.castlabs.android.drm
Class KeyStore
java.lang.Object
com.castlabs.android.drm.KeyStore
- Direct Known Subclasses:
MemoryKeyStore
,SharedPreferencesKeyStore
Implementations of this interface are used by the DRM Session to store and retrieve
keySetIds that are used to store offline licenses. Please note that implementations
of this store are not holding the license itself but the key that is used by the
MediaDrm
to restore the license if possible.- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
add
(String id, DrmKeyStorage drmKeyStorage) Add a drm key to the storagefinal boolean
Remove the stored key with the matching id NOTE: If you want to actually remove a key from the device, you should instead useDrmLicenseLoader.remove()
.final Map
<String, DrmKeyStorage> Remove all stored keysfinal DrmKeyStorage
Get a DrmKeyStoragefinal Map
<String, DrmKeyStorage> getAll()
Get all stored keysabstract int
Get count of stored license keys
-
Constructor Details
-
KeyStore
public KeyStore()
-
-
Method Details
-
add
Add a drm key to the storage- Parameters:
id
- the id to identify the asset, movie, or stream this entry belongs todrmKeyStorage
- instance ofDrmKeyStorage
-
get
Get a DrmKeyStorage- Parameters:
id
- the id for the DrmKeyStorage to get- Returns:
- the DrmKeyStorage
-
getAll
Get all stored keys- Returns:
- A Map containing all the stored keys
-
deleteAll
Remove all stored keys- Returns:
- A Map containing all the stored keys
-
delete
Remove the stored key with the matching id NOTE: If you want to actually remove a key from the device, you should instead useDrmLicenseLoader.remove()
. If the a license is removed *only* from theKeyStore
it will still be present in the device.- Parameters:
id
- the id to be removed, used to identify the asset- Returns:
- true of key successfully removed, false otherwise
-
getLicenseKeysCount
public abstract int getLicenseKeysCount()Get count of stored license keys- Returns:
- count of stored keys
-