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.
69 lines
2.4 KiB
C++
69 lines
2.4 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_V3_H
|
|
#define ECM_PARSER_V3_H
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "cas_types.h"
|
|
#include "ecm_parser.h"
|
|
#include "media_cas.pb.h"
|
|
|
|
namespace wvcas {
|
|
|
|
// EcmParser allows random access to the fields of an ECM.
|
|
class EcmParserV3 : public EcmParser {
|
|
public:
|
|
~EcmParserV3() override = default;
|
|
EcmParserV3(const EcmParserV3&) = delete;
|
|
EcmParserV3& operator=(const EcmParserV3&) = delete;
|
|
|
|
// The EcmParserV3 factory method.
|
|
// |ecm| must be Widevine ECM v3 (or higher if compatible) without section
|
|
// header. Validates the ecm. If validations is successful returns an
|
|
// EcmParserV3, otherwise an nullptr.
|
|
static std::unique_ptr<EcmParserV3> Create(const CasEcm& ecm);
|
|
|
|
// Accessor methods.
|
|
uint8_t version() const override;
|
|
CryptoMode crypto_mode() const override;
|
|
bool rotation_enabled() const override;
|
|
size_t content_iv_size() const override;
|
|
uint8_t age_restriction() const override;
|
|
std::vector<uint8_t> entitlement_key_id(KeySlotId id) const override;
|
|
std::vector<uint8_t> content_key_id(KeySlotId id) const override;
|
|
std::vector<uint8_t> wrapped_key_data(KeySlotId id) const override;
|
|
std::vector<uint8_t> wrapped_key_iv(KeySlotId id) const override;
|
|
std::vector<uint8_t> content_iv(KeySlotId id) const override;
|
|
|
|
bool set_group_id(const std::string& group_id) override;
|
|
|
|
bool has_fingerprinting() const override;
|
|
video_widevine::Fingerprinting fingerprinting() const override;
|
|
bool has_service_blocking() const override;
|
|
video_widevine::ServiceBlocking service_blocking() const override;
|
|
// The serialized payload that the signature is calculated on.
|
|
std::string ecm_serialized_payload() const override;
|
|
std::string signature() const override;
|
|
|
|
bool is_entitlement_rotation_enabled() const override;
|
|
uint32_t entitlement_period_index() const override;
|
|
uint32_t entitlement_rotation_window_left() const override;
|
|
|
|
private:
|
|
// Constructs an EcmParserV3 using |ecm|.
|
|
EcmParserV3(video_widevine::SignedEcmPayload signed_ecm_payload,
|
|
video_widevine::EcmPayload ecm_payload);
|
|
video_widevine::SignedEcmPayload signed_ecm_payload_;
|
|
video_widevine::EcmPayload ecm_payload_;
|
|
video_widevine::EcmKeyData even_key_data_;
|
|
video_widevine::EcmKeyData odd_key_data_;
|
|
};
|
|
|
|
} // namespace wvcas
|
|
|
|
#endif // ECM_PARSER_V3_H
|