9 #ifndef MEDIA_BASE_AES_DECRYPTOR_H_
10 #define MEDIA_BASE_AES_DECRYPTOR_H_
15 #include "packager/base/memory/scoped_ptr.h"
16 #include "packager/base/stl_util.h"
17 #include "packager/media/base/aes_encryptor.h"
20 typedef struct aes_key_st AES_KEY;
22 namespace edash_packager {
33 const std::vector<uint8_t>& iv) = 0;
38 bool Decrypt(
const std::vector<uint8_t>& ciphertext,
39 std::vector<uint8_t>* plaintext);
40 bool Decrypt(
const std::string& ciphertext, std::string* plaintext);
41 bool Decrypt(
const uint8_t* ciphertext,
42 size_t ciphertext_size,
44 size_t plaintext_size;
52 virtual bool SetIv(
const std::vector<uint8_t>& iv) = 0;
63 size_t ciphertext_size,
65 size_t* plaintext_size) = 0;
80 const std::vector<uint8_t>& iv)
override;
82 bool SetIv(
const std::vector<uint8_t>& iv)
override;
85 uint32_t block_offset()
const {
return encryptor_->block_offset(); }
89 size_t ciphertext_size,
91 size_t* plaintext_size)
override;
94 scoped_ptr<AesCtrEncryptor> encryptor_;
107 AesCbcDecryptor(CbcPaddingScheme padding_scheme,
bool chain_across_calls);
113 const std::vector<uint8_t>& iv)
override;
115 bool SetIv(
const std::vector<uint8_t>& iv)
override;
120 size_t ciphertext_size,
122 size_t* plaintext_size)
override;
126 scoped_ptr<AES_KEY> aes_key_;
128 std::vector<uint8_t> iv_;
129 const CbcPaddingScheme padding_scheme_;
130 const bool chain_across_calls_;
138 #endif // MEDIA_BASE_AES_DECRYPTOR_H_