diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 1545b870fc..e2aba8d0ac 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -61,6 +61,8 @@ `DecoderVideoRenderer` and `DecoderAudioRenderer` respectively, and generalized to work with `Decoder` rather than `SimpleDecoder`. * Add media item based playlist API to Player. + * Update `CachedContentIndex` to use `SecureRandom` for generating the + initialization vector used to encrypt the cache contents. * Text: * Parse `` and `` tags in WebVTT subtitles (rendering is coming later). diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java index 1b9b4a3629..43bf691701 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java @@ -45,11 +45,11 @@ import java.io.OutputStream; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Map; -import java.util.Random; import java.util.Set; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; @@ -494,7 +494,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; private final boolean encrypt; @Nullable private final Cipher cipher; @Nullable private final SecretKeySpec secretKeySpec; - @Nullable private final Random random; + @Nullable private final SecureRandom random; private final AtomicFile atomicFile; private boolean changed; @@ -517,7 +517,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; this.encrypt = encrypt; this.cipher = cipher; this.secretKeySpec = secretKeySpec; - random = encrypt ? new Random() : null; + random = encrypt ? new SecureRandom() : null; atomicFile = new AtomicFile(file); }