DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerator
aes_decryptor.h
1 // Copyright 2016 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 //
7 // AES Decryptor implementation using openssl.
8 
9 #ifndef PACKAGER_MEDIA_BASE_AES_DECRYPTOR_H_
10 #define PACKAGER_MEDIA_BASE_AES_DECRYPTOR_H_
11 
12 #include <vector>
13 
14 #include "packager/base/macros.h"
15 #include "packager/media/base/aes_cryptor.h"
16 #include "packager/media/base/aes_encryptor.h"
17 
18 namespace edash_packager {
19 namespace media {
20 
22 using AesCtrDecryptor = AesCtrEncryptor;
23 
25 class AesCbcDecryptor : public AesCryptor {
26  public:
32  AesCbcDecryptor(CbcPaddingScheme padding_scheme, bool chain_across_calls);
33  ~AesCbcDecryptor() override;
34 
37  bool InitializeWithIv(const std::vector<uint8_t>& key,
38  const std::vector<uint8_t>& iv) override;
39  bool SetIv(const std::vector<uint8_t>& iv) override;
40  void UpdateIv() override {
41  // Nop for decryptor.
42  }
44 
45  private:
46  bool CryptInternal(const uint8_t* ciphertext,
47  size_t ciphertext_size,
48  uint8_t* plaintext,
49  size_t* plaintext_size) override;
50 
51  const CbcPaddingScheme padding_scheme_;
52  const bool chain_across_calls_;
53 
54  DISALLOW_COPY_AND_ASSIGN(AesCbcDecryptor);
55 };
56 
57 } // namespace media
58 } // namespace edash_packager
59 
60 #endif // PACKAGER_MEDIA_BASE_AES_DECRYPTOR_H_
Class which implements AES-CBC (Cipher block chaining) decryption.
Definition: aes_decryptor.h:25
bool SetIv(const std::vector< uint8_t > &iv) override
bool InitializeWithIv(const std::vector< uint8_t > &key, const std::vector< uint8_t > &iv) override
AesCbcDecryptor(CbcPaddingScheme padding_scheme, bool chain_across_calls)
const std::vector< uint8_t > & iv() const
Definition: aes_cryptor.h:60