Shaka Packager SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
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 shaka {
19 namespace media {
20 
22 using AesCtrDecryptor = AesCtrEncryptor;
23 
25 class AesCbcDecryptor : public AesCryptor {
26  public:
31  explicit AesCbcDecryptor(CbcPaddingScheme padding_scheme);
32 
40  AesCbcDecryptor(CbcPaddingScheme padding_scheme,
41  ConstantIvFlag constant_iv_flag);
42 
43  ~AesCbcDecryptor() override;
44 
47  bool InitializeWithIv(const std::vector<uint8_t>& key,
48  const std::vector<uint8_t>& iv) override;
50 
51  private:
52  bool CryptInternal(const uint8_t* ciphertext,
53  size_t ciphertext_size,
54  uint8_t* plaintext,
55  size_t* plaintext_size) override;
56  void SetIvInternal() override;
57 
58  const CbcPaddingScheme padding_scheme_;
59  // 16-byte internal iv for crypto operations.
60  std::vector<uint8_t> internal_iv_;
61 
62  DISALLOW_COPY_AND_ASSIGN(AesCbcDecryptor);
63 };
64 
65 } // namespace media
66 } // namespace shaka
67 
68 #endif // PACKAGER_MEDIA_BASE_AES_DECRYPTOR_H_
Class which implements AES-CBC (Cipher block chaining) decryption.
Definition: aes_decryptor.h:25
AesCbcDecryptor(CbcPaddingScheme padding_scheme)
const std::vector< uint8_t > & iv() const
Definition: aes_cryptor.h:81
bool InitializeWithIv(const std::vector< uint8_t > &key, const std::vector< uint8_t > &iv) override