2014-05-08 21:02:36 +00:00
|
|
|
// Copyright 2014 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
//
|
|
|
|
// Defines command line flags for fixed key encryption.
|
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/app/fixed_key_encryption_flags.h"
|
2014-05-08 21:02:36 +00:00
|
|
|
|
|
|
|
DEFINE_bool(enable_fixed_key_encryption,
|
|
|
|
false,
|
|
|
|
"Enable encryption with fixed key.");
|
2014-08-25 22:51:19 +00:00
|
|
|
DEFINE_bool(enable_fixed_key_decryption,
|
|
|
|
false,
|
|
|
|
"Enable decryption with fixed key.");
|
2014-05-08 21:02:36 +00:00
|
|
|
DEFINE_string(key_id, "", "Key id in hex string format.");
|
|
|
|
DEFINE_string(key, "", "Key in hex string format.");
|
|
|
|
DEFINE_string(pssh, "", "PSSH in hex string format.");
|
|
|
|
|
|
|
|
static bool IsNotEmptyWithFixedKeyEncryption(const char* flag_name,
|
|
|
|
const std::string& flag_value) {
|
2014-08-25 22:51:19 +00:00
|
|
|
if (FLAGS_enable_fixed_key_encryption && flag_value.empty())
|
|
|
|
return false;
|
|
|
|
std::string flag_name_str(flag_name);
|
|
|
|
if (FLAGS_enable_fixed_key_decryption && (flag_name_str != "pssh") &&
|
|
|
|
flag_value.empty())
|
|
|
|
return false;
|
|
|
|
return true;
|
2014-05-08 21:02:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool dummy_key_id_validator =
|
|
|
|
google::RegisterFlagValidator(&FLAGS_key_id,
|
|
|
|
&IsNotEmptyWithFixedKeyEncryption);
|
|
|
|
static bool dummy_key_validator =
|
|
|
|
google::RegisterFlagValidator(&FLAGS_key,
|
|
|
|
&IsNotEmptyWithFixedKeyEncryption);
|
|
|
|
static bool dummy_pssh_validator =
|
|
|
|
google::RegisterFlagValidator(&FLAGS_pssh,
|
|
|
|
&IsNotEmptyWithFixedKeyEncryption);
|