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 {
35 const std::vector<uint8_t>&
iv)
override;
55 bool SetIv(
const std::vector<uint8_t>&
iv)
override;
58 uint32_t block_offset()
const {
return block_offset_; }
61 bool CryptInternal(
const uint8_t* plaintext,
62 size_t plaintext_size,
64 size_t* ciphertext_size)
override;
67 uint32_t block_offset_;
69 std::vector<uint8_t> counter_;
71 std::vector<uint8_t> encrypted_counter_;
73 bool counter_overflow_;
78 enum CbcPaddingScheme {
84 const bool kChainAcrossCalls =
true;
94 AesCbcEncryptor(CbcPaddingScheme padding_scheme,
bool chain_across_calls);
101 bool SetIv(
const std::vector<uint8_t>&
iv)
override;
105 bool CryptInternal(
const uint8_t* plaintext,
106 size_t plaintext_size,
108 size_t* ciphertext_size)
override;
109 size_t NumPaddingBytes(
size_t size)
const override;
111 const CbcPaddingScheme padding_scheme_;
112 const bool chain_across_calls_;
120 #endif // MEDIA_BASE_AES_ENCRYPTOR_H_