diff --git a/example/wv_cas_ecm_example b/example/wv_cas_ecm_example index c0792ae..7cec6db 100644 Binary files a/example/wv_cas_ecm_example and b/example/wv_cas_ecm_example differ diff --git a/example/wv_cas_ecm_example.cc b/example/wv_cas_ecm_example.cc index 4d65e34..3473d6b 100644 --- a/example/wv_cas_ecm_example.cc +++ b/example/wv_cas_ecm_example.cc @@ -12,11 +12,10 @@ #include #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) diff --git a/libmedia_cas_packager_sdk.so b/libmedia_cas_packager_sdk.so index dcd61e6..1c3ad44 100755 Binary files a/libmedia_cas_packager_sdk.so and b/libmedia_cas_packager_sdk.so differ diff --git a/media_cas_packager_sdk/public/wv_cas_ca_descriptor.h b/media_cas_packager_sdk/public/wv_cas_ca_descriptor.h index baea1bf..b61c988 100644 --- a/media_cas_packager_sdk/public/wv_cas_ca_descriptor.h +++ b/media_cas_packager_sdk/public/wv_cas_ca_descriptor.h @@ -12,7 +12,7 @@ #include #include -#include "media_cas_packager_sdk/public/wv_cas_status.h" +#include "media_cas_packager_sdk/public/wv_cas_types.h" namespace widevine { namespace cas { diff --git a/media_cas_packager_sdk/public/wv_cas_ecm.h b/media_cas_packager_sdk/public/wv_cas_ecm.h index 5b089b8..0d38c43 100644 --- a/media_cas_packager_sdk/public/wv_cas_ecm.h +++ b/media_cas_packager_sdk/public/wv_cas_ecm.h @@ -16,7 +16,7 @@ #include #include -#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 diff --git a/media_cas_packager_sdk/public/wv_cas_status.h b/media_cas_packager_sdk/public/wv_cas_types.h similarity index 77% rename from media_cas_packager_sdk/public/wv_cas_status.h rename to media_cas_packager_sdk/public/wv_cas_types.h index 99e49f6..63977c9 100644 --- a/media_cas_packager_sdk/public/wv_cas_status.h +++ b/media_cas_packager_sdk/public/wv_cas_types.h @@ -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 @@ -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_