cenc_decryptor.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_CDM_CENC_DECRYPTOR_H_
  5. #define MEDIA_CDM_CENC_DECRYPTOR_H_
  6. #include "base/memory/ref_counted.h"
  7. #include "media/base/media_export.h"
  8. namespace crypto {
  9. class SymmetricKey;
  10. }
  11. namespace media {
  12. class DecoderBuffer;
  13. // This class implements 'cenc' AES-CTR scheme as specified by
  14. // ISO/IEC 23001-7:2016, section 10.1 (https://www.iso.org). Decryption
  15. // uses the Advanced Encryption Standard specified by AES [FIPS-197,
  16. // https://www.nist.gov] using 128-bit keys in Counter Mode (AES-CTR-128),
  17. // as specified in Block Cipher Modes [NIST 800-38A, https://www.nist.gov].
  18. //
  19. // Each input buffer is divided into one or more contiguous subsamples. Each
  20. // subsample has an unprotected part (unencrypted) followed by a protected part
  21. // (encrypted), only one of which may be zero bytes in length. For example:
  22. // | DecoderBuffer.data() |
  23. // | Subsample#1 | Subsample#2 | Subsample#3 |
  24. // |uuuuu|eeeeeeeeee|uuuu|eeeeeeeeeeee|uu|eeeeeeeeeeee|
  25. // Subsample encryption encrypts all the bytes in the protected part of the
  26. // sample. The protected byte sequences of all subsamples is treated as a
  27. // logically continuous chain of 16 byte cipher blocks, even when they are
  28. // separated by unprotected data.
  29. //
  30. // If no subsamples are specified, the whole input buffer will be treated as
  31. // protected data.
  32. // Decrypts the encrypted buffer |input| using |key| and values found in
  33. // |input|->DecryptConfig. The key size must be 128 bits.
  34. MEDIA_EXPORT scoped_refptr<DecoderBuffer> DecryptCencBuffer(
  35. const DecoderBuffer& input,
  36. const crypto::SymmetricKey& key);
  37. } // namespace media
  38. #endif // MEDIA_CDM_CENC_DECRYPTOR_H_