Shaka Packager SDK
Loading...
Searching...
No Matches
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 <cstddef>
8#include <cstdint>
9#include <memory>
10#include <vector>
11
12#include <packager/macros/classes.h>
13#include <packager/media/base/aes_cryptor.h>
14
15namespace shaka {
16namespace media {
17
20 public:
37
53 AesPatternCryptor(uint8_t crypt_byte_block,
54 uint8_t skip_byte_block,
55 PatternEncryptionMode encryption_mode,
56 ConstantIvFlag constant_iv_flag,
57 std::unique_ptr<AesCryptor> cryptor);
58 ~AesPatternCryptor() override;
59
62 bool InitializeWithIv(const std::vector<uint8_t>& key,
63 const std::vector<uint8_t>& iv) override;
65
66 private:
67 bool CryptInternal(const uint8_t* text,
68 size_t text_size,
69 uint8_t* crypt_text,
70 size_t* crypt_text_size) override;
71 void SetIvInternal() override;
72
73 uint8_t crypt_byte_block_;
74 const uint8_t skip_byte_block_;
75 const PatternEncryptionMode encryption_mode_;
76 std::unique_ptr<AesCryptor> cryptor_;
77
78 DISALLOW_COPY_AND_ASSIGN(AesPatternCryptor);
79};
80
81} // namespace media
82} // namespace shaka
const std::vector< uint8_t > & iv() const
Definition aes_cryptor.h:86
Implements pattern-based encryption/decryption.
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.