(1) Move the CryptoMode enum definition to media_cas_packager_sdk partners can use it when calling libraries in the SDK.
(2) Add a new enum value for kDvbCsa. (3) Allow caller to specify CTR, CBC, as well as CSA when using the ecm genertor from the SDK. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219707788
This commit is contained in:
Binary file not shown.
@@ -12,11 +12,10 @@
|
||||
#include <string>
|
||||
|
||||
#include "media_cas_packager_sdk/public/wv_cas_ecm.h"
|
||||
#include "media_cas_packager_sdk/public/wv_cas_status.h"
|
||||
#include "media_cas_packager_sdk/public/wv_cas_types.h"
|
||||
|
||||
const int kContentIvSize = 16;
|
||||
const bool kKeyRotationEnabled = true;
|
||||
const int kCryptoMode = 1; // CTR
|
||||
const char kEvenKey[] = "even_content_key"; // 16 bytes
|
||||
const char kEvenContentIv8Bytes[] = "evencont"; // 8 bytes
|
||||
const char kEvenContentIv16Bytes[] = "evencontevencont"; // 16 bytes
|
||||
@@ -29,7 +28,8 @@ const char kEntitlementKey[] = "entitlement_key................."; // 32 bytes
|
||||
int main(int argc, char **argv) {
|
||||
widevine::cas::WvCasEcm wv_cas_ecm;
|
||||
widevine::cas::WvCasStatus status =
|
||||
wv_cas_ecm.Initialize(kContentIvSize, kKeyRotationEnabled, kCryptoMode);
|
||||
wv_cas_ecm.Initialize(kContentIvSize, kKeyRotationEnabled,
|
||||
widevine::cas::CryptoMode::kDvbCsa);
|
||||
if (status != widevine::cas::OK) {
|
||||
std::cerr << "Failed to initialize WV CAS ECM, error: "
|
||||
<< widevine::cas::GetWvCasStatusMessage(status)
|
||||
|
||||
Binary file not shown.
@@ -12,7 +12,7 @@
|
||||
#include <stddef.h>
|
||||
#include <string>
|
||||
|
||||
#include "media_cas_packager_sdk/public/wv_cas_status.h"
|
||||
#include "media_cas_packager_sdk/public/wv_cas_types.h"
|
||||
|
||||
namespace widevine {
|
||||
namespace cas {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "media_cas_packager_sdk/public/wv_cas_status.h"
|
||||
#include "media_cas_packager_sdk/public/wv_cas_types.h"
|
||||
|
||||
namespace widevine {
|
||||
namespace cas {
|
||||
@@ -42,9 +42,7 @@ class WvCasEcm {
|
||||
// if this is 'true' only subsequent call to GenerateEcm will be allowed,
|
||||
// if this is 'false' only subsequent call to GenerateSingleKeyEcm will
|
||||
// be allowed
|
||||
// - |crypto_mode| crypto mode for encrypting content,
|
||||
// kCryptoModeCbc = 0, kCryptoModeCtr = 1
|
||||
// only CTR is supported by Widevine CAS plugin for now
|
||||
// - |crypto_mode| crypto mode for encrypting content
|
||||
//
|
||||
// Returns:
|
||||
// - A status indicating whether there was any error during initialization
|
||||
@@ -52,7 +50,7 @@ class WvCasEcm {
|
||||
// Note:
|
||||
// - 'even'/'odd' key in the ECM will be be encrypted using AEC_CBC
|
||||
virtual WvCasStatus Initialize(int content_iv_size, bool key_rotation_enabled,
|
||||
int crypto_mode);
|
||||
CryptoMode crypto_mode);
|
||||
|
||||
// Generate an ECM containing two keys (even and odd). Can be called when
|
||||
// |key_rotation_enabled| is initialized to 'true'.
|
||||
@@ -108,7 +106,7 @@ class WvCasEcm {
|
||||
bool initialized_ = false;
|
||||
int content_iv_size_;
|
||||
bool key_rotation_enabled_;
|
||||
int crypto_mode_;
|
||||
CryptoMode crypto_mode_;
|
||||
};
|
||||
|
||||
} // namespace cas
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// widevine-licensing@google.com.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_STATUS_H_
|
||||
#define MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_STATUS_H_
|
||||
#ifndef MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_TYPES_H_
|
||||
#define MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_TYPES_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -50,7 +50,19 @@ enum WvCasStatus {
|
||||
// Returns the message std::string for the given WvCasStatus.
|
||||
std::string GetWvCasStatusMessage(WvCasStatus status);
|
||||
|
||||
// Crypto mode for encryption / decryption.
|
||||
enum class CryptoMode : int {
|
||||
kCryptoModeUnspecified = 0,
|
||||
kAesCtr = 1,
|
||||
kAesCbc = 2,
|
||||
kDvbCsa = 3
|
||||
};
|
||||
|
||||
std::string CryptoModeToString(CryptoMode mode);
|
||||
|
||||
CryptoMode StringToCryptoMode(std::string str);
|
||||
|
||||
} // namespace cas
|
||||
} // namespace widevine
|
||||
|
||||
#endif // MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_STATUS_H_
|
||||
#endif // MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_TYPES_H_
|
||||
Reference in New Issue
Block a user