// Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary // source code may only be used and distributed under the Widevine License // Agreement. #ifndef WIDEVINE_PROVISIONER_H_ #define WIDEVINE_PROVISIONER_H_ #include #include #include #include #include #include #include "WidevineOemcryptoInterface.h" namespace widevine { class WidevineProvisioner { public: WidevineProvisioner(); WidevineProvisioner(const WidevineProvisioner&) = delete; WidevineProvisioner& operator=(const WidevineProvisioner&) = delete; virtual ~WidevineProvisioner() = default; bool GenerateCertificateRequest( bool testMode, const std::vector& endpointEncCertChain, std::vector& deviceInfo, std::vector& protectedData); bool GenerateCertificateRequestV2(const std::vector& challenge, std::vector* csr); private: bool GetDeviceInfo(std::vector& device_info); bool GenerateProtectedData( bool test_mode, const std::vector& endpoint_encryption_cert_chain, std::vector bcc, std::vector& protected_data) const; bool ValidateAndExtractEekPubAndId( bool test_mode, const std::vector& endpoint_encryption_cert_chain, std::vector* eek_pub, std::vector* eek_id) const; cppbor::Array BuildCertReqRecipients(const std::vector& pubkey, const std::vector& kid) const; void InitializeCryptoInterface(); bool GetDeviceInfoCommon(cppbor::Map& device_info_map); bool TryAddVerifiedDeviceInfo(cppbor::Map& device_info_map); bool GetDeviceInfoV2(cppbor::Map& device_info_map); std::unique_ptr crypto_interface_; }; } // namespace widevine #endif // WIDEVINE_PROVISIONER_H_