Add CTR encryption.
- Added ContentEncAESSettings, AESSettingsCipherMode, AESSettingsCipherInitData elements to the parser and muxer. - Changed ParseContentEncodingsEntry, ParseContentEncodingEntry, and ParseEncryptionEntry to use PasreElementHeader. - Added ParseContentEncAESSettingsEntry function. - PS6 removed AESSettingsCipherInitData. - PS9 Addressed comments, Fixed some LINT issues, and converted mkvwriter.h/.cpp to Unix line endings. - PS10 Addressed comments. Change-Id: I9d96a0c194f74a6c9bf0001aa0286196e410f07e
This commit is contained in:
53
mkvmuxer.hpp
53
mkvmuxer.hpp
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011 The WebM project authors. All Rights Reserved.
|
||||
// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the LICENSE file in the root of the source
|
||||
@@ -179,23 +179,49 @@ class Cues {
|
||||
LIBWEBM_DISALLOW_COPY_AND_ASSIGN(Cues);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// ContentEncAESSettings element
|
||||
class ContentEncAESSettings {
|
||||
public:
|
||||
enum {
|
||||
kCTR = 1
|
||||
};
|
||||
|
||||
ContentEncAESSettings();
|
||||
~ContentEncAESSettings() {}
|
||||
|
||||
// Returns the size in bytes for the ContentEncAESSettings element.
|
||||
uint64 Size() const;
|
||||
|
||||
// Writes out the ContentEncAESSettings element to |writer|. Returns true on
|
||||
// success.
|
||||
bool Write(IMkvWriter* writer) const;
|
||||
|
||||
uint64 cipher_mode() const { return cipher_mode_; }
|
||||
|
||||
private:
|
||||
// Returns the size in bytes for the payload of the ContentEncAESSettings
|
||||
// element.
|
||||
uint64 PayloadSize() const;
|
||||
|
||||
// Sub elements
|
||||
uint64 cipher_mode_;
|
||||
|
||||
LIBWEBM_DISALLOW_COPY_AND_ASSIGN(ContentEncAESSettings);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// ContentEncoding element
|
||||
// Elements used to describe if the track data has been encrypted or
|
||||
// compressed with zlib or header stripping.
|
||||
// Currently only whole frames can only be encrypted once with AES. This
|
||||
// dictates that ContentEncodingOrder will be 0, ContentEncodingScope will
|
||||
// be 1, ContentEncodingType will be 1, and ContentEncAlgo will be 5.
|
||||
// Currently only whole frames can be encrypted with AES. This dictates that
|
||||
// ContentEncodingOrder will be 0, ContentEncodingScope will be 1,
|
||||
// ContentEncodingType will be 1, and ContentEncAlgo will be 5.
|
||||
class ContentEncoding {
|
||||
public:
|
||||
ContentEncoding();
|
||||
~ContentEncoding();
|
||||
|
||||
uint64 enc_algo() const { return enc_algo_; }
|
||||
uint64 encoding_order() const { return encoding_order_; }
|
||||
uint64 encoding_scope() const { return encoding_scope_; }
|
||||
uint64 encoding_type() const { return encoding_type_; }
|
||||
|
||||
// Sets the content encryption id. Copies |length| bytes from |id| to
|
||||
// |enc_key_id_|. Returns true on success.
|
||||
bool SetEncryptionID(const uint8* id, uint64 length);
|
||||
@@ -207,6 +233,12 @@ class ContentEncoding {
|
||||
// success.
|
||||
bool Write(IMkvWriter* writer) const;
|
||||
|
||||
uint64 enc_algo() const { return enc_algo_; }
|
||||
uint64 encoding_order() const { return encoding_order_; }
|
||||
uint64 encoding_scope() const { return encoding_scope_; }
|
||||
uint64 encoding_type() const { return encoding_type_; }
|
||||
ContentEncAESSettings* enc_aes_settings() { return &enc_aes_settings_; }
|
||||
|
||||
private:
|
||||
// Returns the size in bytes for the encoding elements.
|
||||
uint64 EncodingSize(uint64 compresion_size, uint64 encryption_size) const;
|
||||
@@ -221,6 +253,9 @@ class ContentEncoding {
|
||||
uint64 encoding_scope_;
|
||||
uint64 encoding_type_;
|
||||
|
||||
// ContentEncAESSettings element.
|
||||
ContentEncAESSettings enc_aes_settings_;
|
||||
|
||||
// Size of the ContentEncKeyID data in bytes.
|
||||
uint64 enc_key_id_length_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user