Shaka Packager SDK
aes_pattern_cryptor.h
1 // Copyright 2016 Google LLC. 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 #include <memory>
8 
9 #include <packager/macros/classes.h>
10 #include <packager/media/base/aes_cryptor.h>
11 
12 namespace shaka {
13 namespace media {
14 
16 class AesPatternCryptor : public AesCryptor {
17  public:
33  };
34 
50  AesPatternCryptor(uint8_t crypt_byte_block,
51  uint8_t skip_byte_block,
52  PatternEncryptionMode encryption_mode,
53  ConstantIvFlag constant_iv_flag,
54  std::unique_ptr<AesCryptor> cryptor);
55  ~AesPatternCryptor() override;
56 
59  bool InitializeWithIv(const std::vector<uint8_t>& key,
60  const std::vector<uint8_t>& iv) override;
62 
63  private:
64  bool CryptInternal(const uint8_t* text,
65  size_t text_size,
66  uint8_t* crypt_text,
67  size_t* crypt_text_size) override;
68  void SetIvInternal() override;
69 
70  uint8_t crypt_byte_block_;
71  const uint8_t skip_byte_block_;
72  const PatternEncryptionMode encryption_mode_;
73  std::unique_ptr<AesCryptor> cryptor_;
74 
75  DISALLOW_COPY_AND_ASSIGN(AesPatternCryptor);
76 };
77 
78 } // namespace media
79 } // namespace shaka
const std::vector< uint8_t > & iv() const
Definition: aes_cryptor.h:85
Implements pattern-based encryption/decryption.
AesPatternCryptor(uint8_t crypt_byte_block, uint8_t skip_byte_block, PatternEncryptionMode encryption_mode, ConstantIvFlag constant_iv_flag, std::unique_ptr< AesCryptor > cryptor)
bool InitializeWithIv(const std::vector< uint8_t > &key, const std::vector< uint8_t > &iv) override
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66