Class KeyStore

Direct Known Subclasses:
MemoryKeyStore, SharedPreferencesKeyStore

public abstract class KeyStore extends Object
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.
  • Constructor Details

    • KeyStore

      public KeyStore()
  • Method Details

    • add

      public final void add(@NonNull String id, @NonNull DrmKeyStorage drmKeyStorage)
      Add a drm key to the storage
      id - the id to identify the asset, movie, or stream this entry belongs to
      drmKeyStorage - instance of DrmKeyStorage
    • get

      @Nullable public final DrmKeyStorage get(@NonNull String id)
      Get a DrmKeyStorage
      id - the id for the DrmKeyStorage to get
      the DrmKeyStorage
    • getAll

      @NonNull public final Map<String,DrmKeyStorage> getAll()
      Get all stored keys
      A Map containing all the stored keys
    • deleteAll

      @NonNull public final Map<String,DrmKeyStorage> deleteAll()
      Remove all stored keys
      A Map containing all the stored keys
    • delete

      public final boolean delete(@NonNull String id)
      Remove the stored key with the matching id NOTE: If you want to actually remove a key from the device, you should instead use DrmLicenseLoader.remove(). If the a license is removed *only* from the KeyStore it will still be present in the device.
      id - the id to be removed, used to identify the asset
      true of key successfully removed, false otherwise
    • getLicenseKeysCount

      public abstract int getLicenseKeysCount()
      Get count of stored license keys
      count of stored keys