Replace hardcoded parameters
This commit is contained in:
@@ -10,9 +10,13 @@
|
||||
|
||||
#include "glog/logging.h"
|
||||
#include "common/aes_cbc_util.h"
|
||||
#include "common/client_cert.h"
|
||||
#include "common/drm_service_certificate.h"
|
||||
#include "common/error_space.h"
|
||||
#include "common/keybox_client_cert.h"
|
||||
#include "protos/public/drm_certificate.pb.h"
|
||||
#include "protos/public/errors.pb.h"
|
||||
#include "protos/public/signed_drm_certificate.pb.h"
|
||||
|
||||
namespace widevine {
|
||||
|
||||
@@ -37,12 +41,13 @@ bool SetClientInfo(ClientIdentification* client_id, absl::string_view name,
|
||||
}
|
||||
|
||||
std::string GetClientInfo(const ClientIdentification& client_id,
|
||||
absl::string_view name) {
|
||||
absl::string_view name) {
|
||||
return GetClientInfo(client_id, name, std::string());
|
||||
}
|
||||
|
||||
std::string GetClientInfo(const ClientIdentification& client_id,
|
||||
absl::string_view name, const std::string& default_value) {
|
||||
absl::string_view name,
|
||||
const std::string& default_value) {
|
||||
for (const auto& nv : client_id.client_info()) {
|
||||
if (nv.name() == name) {
|
||||
return nv.value();
|
||||
@@ -86,4 +91,28 @@ Status DecryptEncryptedClientIdentification(
|
||||
return OkStatus();
|
||||
}
|
||||
|
||||
uint32_t GetSystemId(const ClientIdentification& client_id) {
|
||||
uint32_t system_id = 0;
|
||||
if (client_id.has_token()) {
|
||||
switch (client_id.type()) {
|
||||
case ClientIdentification::KEYBOX:
|
||||
system_id = KeyboxClientCert::GetSystemId(client_id.token());
|
||||
break;
|
||||
case ClientIdentification::DRM_DEVICE_CERTIFICATE: {
|
||||
SignedDrmCertificate signed_drm_certificate;
|
||||
if (signed_drm_certificate.ParseFromString(client_id.token())) {
|
||||
DrmCertificate drm_certificate;
|
||||
if (drm_certificate.ParseFromString(
|
||||
signed_drm_certificate.drm_certificate())) {
|
||||
system_id = drm_certificate.system_id();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return system_id;
|
||||
}
|
||||
|
||||
} // namespace widevine
|
||||
|
||||
Reference in New Issue
Block a user