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 <cstdint>
8#include <memory>
9
10#include <packager/macros/classes.h>
11#include <packager/media/base/aes_cryptor.h>
12
13namespace shaka {
14namespace media {
15
18 public:
35
51 AesPatternCryptor(uint8_t crypt_byte_block,
52 uint8_t skip_byte_block,
53 PatternEncryptionMode encryption_mode,
54 ConstantIvFlag constant_iv_flag,
55 std::unique_ptr<AesCryptor> cryptor);
56 ~AesPatternCryptor() override;
57
60 bool InitializeWithIv(const std::vector<uint8_t>& key,
61 const std::vector<uint8_t>& iv) override;
63
64 private:
65 bool CryptInternal(const uint8_t* text,
66 size_t text_size,
67 uint8_t* crypt_text,
68 size_t* crypt_text_size) override;
69 void SetIvInternal() override;
70
71 uint8_t crypt_byte_block_;
72 const uint8_t skip_byte_block_;
73 const PatternEncryptionMode encryption_mode_;
74 std::unique_ptr<AesCryptor> cryptor_;
75
76 DISALLOW_COPY_AND_ASSIGN(AesPatternCryptor);
77};
78
79} // namespace media
80} // 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.