Note that this version does not have Widevine Provisioning 4.0 support. It is only suitable for device upgrades. A new patch with provisioning 4.0 support will be made later.
60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
|
|
#ifndef ECM_PARSER_H
|
|
#define ECM_PARSER_H
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "cas_types.h"
|
|
#include "media_cas.pb.h"
|
|
|
|
namespace wvcas {
|
|
|
|
enum class KeySlotId { kEvenKeySlot, kOddKeySlot };
|
|
|
|
// EcmParser allows random access to the fields of an ECM.
|
|
class EcmParser {
|
|
public:
|
|
EcmParser() = default;
|
|
virtual ~EcmParser() {}
|
|
|
|
// The EcmParser factory method.
|
|
// Validates the ecm. If validations is successful returns true and constructs
|
|
// an EcmParser in |parser| using |ecm|.
|
|
static std::unique_ptr<EcmParser> Create(const CasEcm& ecm);
|
|
|
|
// Accessor methods.
|
|
virtual uint8_t version() const = 0;
|
|
virtual CryptoMode crypto_mode() const = 0;
|
|
virtual bool rotation_enabled() const = 0;
|
|
virtual size_t content_iv_size() const = 0;
|
|
virtual uint8_t age_restriction() const = 0;
|
|
virtual std::vector<uint8_t> entitlement_key_id(KeySlotId id) const = 0;
|
|
virtual std::vector<uint8_t> content_key_id(KeySlotId id) const = 0;
|
|
virtual std::vector<uint8_t> wrapped_key_data(KeySlotId id) const = 0;
|
|
virtual std::vector<uint8_t> wrapped_key_iv(KeySlotId id) const = 0;
|
|
virtual std::vector<uint8_t> content_iv(KeySlotId id) const = 0;
|
|
|
|
// Process group content keys instead of the normal content keys.
|
|
virtual bool set_group_id(const std::string& group_id) = 0;
|
|
|
|
virtual bool has_fingerprinting() const = 0;
|
|
virtual video_widevine::Fingerprinting fingerprinting() const = 0;
|
|
virtual bool has_service_blocking() const = 0;
|
|
virtual video_widevine::ServiceBlocking service_blocking() const = 0;
|
|
// The serialized payload that the signature is calculated on.
|
|
virtual std::string ecm_serialized_payload() const = 0;
|
|
virtual std::string signature() const = 0;
|
|
|
|
virtual bool is_entitlement_rotation_enabled() const = 0;
|
|
virtual uint32_t entitlement_period_index() const = 0;
|
|
virtual uint32_t entitlement_rotation_window_left() const = 0;
|
|
};
|
|
|
|
} // namespace wvcas
|
|
|
|
#endif // ECM_PARSER_H
|