9 #ifndef MEDIA_BASE_AES_ENCRYPTOR_H_
10 #define MEDIA_BASE_AES_ENCRYPTOR_H_
15 #include "packager/base/macros.h"
16 #include "packager/base/memory/scoped_ptr.h"
17 #include "packager/media/base/aes_cryptor.h"
19 namespace edash_packager {
30 const std::vector<uint8_t>&
iv)
override;
50 bool SetIv(
const std::vector<uint8_t>&
iv)
override;
53 uint32_t block_offset()
const {
return block_offset_; }
56 bool CryptInternal(
const uint8_t* plaintext,
57 size_t plaintext_size,
59 size_t* ciphertext_size)
override;
62 uint32_t block_offset_;
64 std::vector<uint8_t> counter_;
66 std::vector<uint8_t> encrypted_counter_;
68 bool counter_overflow_;
73 enum CbcPaddingScheme {
79 const bool kChainAcrossCalls =
true;
89 AesCbcEncryptor(CbcPaddingScheme padding_scheme,
bool chain_across_calls);
96 bool SetIv(
const std::vector<uint8_t>&
iv)
override;
100 bool CryptInternal(
const uint8_t* plaintext,
101 size_t plaintext_size,
103 size_t* ciphertext_size)
override;
104 size_t NumPaddingBytes(
size_t size)
const override;
106 const CbcPaddingScheme padding_scheme_;
107 const bool chain_across_calls_;
115 #endif // MEDIA_BASE_AES_ENCRYPTOR_H_