//////////////////////////////////////////////////////////////////////////////// // Copyright 2016 Google LLC. // // This software is licensed under the terms defined in the Widevine Master // License Agreement. For a copy of this agreement, please contact // widevine-licensing@google.com. //////////////////////////////////////////////////////////////////////////////// // ProvisioningSession internal implementation. #ifndef PROVISIONING_SDK_INTERNAL_PROVISIONING30_SESSION_IMPL_H_ #define PROVISIONING_SDK_INTERNAL_PROVISIONING30_SESSION_IMPL_H_ #include #include #include #include #include "common/rsa_key.h" #include "provisioning_sdk/internal/oem_device_cert.h" #include "provisioning_sdk/internal/provisioning_session_impl.h" #include "provisioning_sdk/public/provisioning_status.h" #include "protos/public/certificate_provisioning.pb.h" #include "protos/public/client_identification.pb.h" #include "protos/public/drm_certificate.pb.h" #include "protos/public/provisioned_device_info.pb.h" namespace widevine { class ProvisioningEngineImpl; class Provisioning30SessionImpl : public ProvisioningSessionImpl { public: Provisioning30SessionImpl(const ProvisioningEngineImpl& engine, const OemDeviceCert& oem_device_cert, const RsaPrivateKey& service_private_key); // Process a message from the client device. // * |message| is the message received from the client device. // * |response| will contain, upon successful return, a message to be sent // back to the client device as a response to |message|. // * |done| will indicate, upon successful return, whether the provisioning // exchange is complete. // Returns OK if successful, or an appropriate error status code otherwise. ProvisioningStatus ProcessMessage(const std::string& message, std::string* response, bool* done) override; // * Returns a ProvisioneddeviceInfo message containing information about the // type of device being provisioned. May return nullptr. const ProvisionedDeviceInfo* GetDeviceInfo() const override { return device_info_.get(); } private: Provisioning30SessionImpl(const Provisioning30SessionImpl&) = delete; Provisioning30SessionImpl& operator=(const Provisioning30SessionImpl&) = delete; bool ValidateAndDeserializeRequest(const std::string& message, SignedProvisioningMessage* signed_request, ProvisioningRequest* request) const; bool DecryptClientIdentification( const EncryptedClientIdentification& encrypted_client_id, ClientIdentification* client_id); ProvisioningStatus GenerateProvisioningResponse( uint32_t system_id, const std::string& oem_ca_serial_number, const std::string& provider_id, const std::string& certificate_serial_number, const RsaPublicKey& cert_public_key, ProvisioningResponse* response); const OemDeviceCert& oem_device_cert_; const RsaPrivateKey& service_private_key_; std::shared_ptr device_info_; }; } // namespace widevine #endif // PROVISIONING_SDK_INTERNAL_PROVISIONING30_SESSION_IMPL_H_