Files
wvpl_license_sdk/ubuntu/license_server_sdk/public/environment.h
2021-07-29 20:09:57 +00:00

48 lines
1.8 KiB
C++

// Copyright 2020 Google LLC. All rights reserved.
#ifndef VIDEO_WIDEVINE_EXPORT_LICENSE_SERVER_SDK_PUBLIC_ENVIRONMENT_H_
#define VIDEO_WIDEVINE_EXPORT_LICENSE_SERVER_SDK_PUBLIC_ENVIRONMENT_H_
#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
#include "common/drm_root_certificate.h"
#include "common/security_profile_list.h"
#include "common/status.h"
namespace video_widevine {
class Environment {
public:
Environment(absl::string_view provider, const DrmRootCertificate* root_cert);
~Environment();
// Add a service certificate system-wide.
// |service_certificate| is a Google-generated certificate used to
// authenticate the service provider for purposes of device privacy;
// |service_private_key| is the encrypted PKCS#8 private RSA key corresponding
// to the service certificate; and |service_private_key_passphrase| is the
// password required to decrypt |service_private_key|.
Status AddDrmServiceCertificate(
const std::string& service_certificate,
const std::string& service_private_key,
const std::string& service_private_key_passphrase);
// Returns true if service certificate is loaded.
bool is_service_certificate_loaded();
private:
// Returns the DRM root certificate configured for this environment.
const video_widevine::DrmRootCertificate* drm_root_certificate() const;
bool is_service_certificate_loaded_ = false;
std::string provider_;
// DRM root certificate used for verifying all other DRM certificates.
const DrmRootCertificate* drm_root_certificate_;
mutable absl::Mutex profile_mutex_;
std::unique_ptr<video_widevine::SecurityProfileList>
device_security_profile_list_ ABSL_GUARDED_BY(profile_mutex_);
friend class EnvironmentTest;
};
} // namespace video_widevine
#endif // VIDEO_WIDEVINE_EXPORT_LICENSE_SERVER_SDK_PUBLIC_ENVIRONMENT_H_