Refactor and cleanup codes. No functional changes.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
################################################################################
|
||||
# Copyright 2016 Google Inc.
|
||||
# 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
|
||||
@@ -13,37 +13,13 @@ package(
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "root_certificates",
|
||||
name = "root_oem_certificates",
|
||||
srcs = [
|
||||
"root_certificates.cc",
|
||||
":drm_ca_root_dev_cert",
|
||||
":drm_ca_root_prod_cert",
|
||||
":drm_ca_root_test_cert",
|
||||
"root_oem_certificates.cc",
|
||||
":oem_ca_root_dev_der",
|
||||
":oem_ca_root_prod_der",
|
||||
],
|
||||
hdrs = ["root_certificates.h"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "drm_ca_root_test_cert",
|
||||
srcs = ["drm_ca_root_test.cert"],
|
||||
outs = ["drm_ca_root_test_cert.h"],
|
||||
cmd = "cd $$(dirname $<) && xxd -i $$(basename $<) $$OLDPWD/$@",
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "drm_ca_root_dev_cert",
|
||||
srcs = ["drm_ca_root_dev.cert"],
|
||||
outs = ["drm_ca_root_dev_cert.h"],
|
||||
cmd = "cd $$(dirname $<) && xxd -i $$(basename $<) $$OLDPWD/$@",
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "drm_ca_root_prod_cert",
|
||||
srcs = ["drm_ca_root_prod.cert"],
|
||||
outs = ["drm_ca_root_prod_cert.h"],
|
||||
cmd = "cd $$(dirname $<) && xxd -i $$(basename $<) $$OLDPWD/$@",
|
||||
hdrs = ["root_oem_certificates.h"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
@@ -61,9 +37,9 @@ genrule(
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "test_certificates",
|
||||
name = "test_oem_certificates",
|
||||
srcs = [
|
||||
"test_certificates.cc",
|
||||
"test_oem_certificates.cc",
|
||||
":backwards_chain_der",
|
||||
":expired_2000_chain_der",
|
||||
":invalid_chain_der",
|
||||
@@ -71,7 +47,7 @@ cc_library(
|
||||
":sysid_2001_chain_der",
|
||||
":sysid_2001_public_key_der",
|
||||
],
|
||||
hdrs = ["test_certificates.h"],
|
||||
hdrs = ["test_oem_certificates.h"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,38 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "provisioning_sdk/internal/certificates/root_certificates.h"
|
||||
|
||||
#include "provisioning_sdk/internal/certificates/drm_ca_root_dev_cert.h"
|
||||
#include "provisioning_sdk/internal/certificates/drm_ca_root_prod_cert.h"
|
||||
#include "provisioning_sdk/internal/certificates/drm_ca_root_test_cert.h"
|
||||
#include "provisioning_sdk/internal/certificates/oem_ca_root_dev_cert.h"
|
||||
#include "provisioning_sdk/internal/certificates/oem_ca_root_prod_cert.h"
|
||||
|
||||
namespace widevine {
|
||||
|
||||
RootCertificates::RootCertificates()
|
||||
: drm_root_test_certificate_(
|
||||
drm_ca_root_test_cert,
|
||||
drm_ca_root_test_cert + drm_ca_root_test_cert_len),
|
||||
drm_root_dev_certificate_(
|
||||
drm_ca_root_dev_cert,
|
||||
drm_ca_root_dev_cert + drm_ca_root_dev_cert_len),
|
||||
drm_root_prod_certificate_(
|
||||
drm_ca_root_prod_cert,
|
||||
drm_ca_root_prod_cert + drm_ca_root_prod_cert_len),
|
||||
oem_root_dev_certificate_(
|
||||
oem_ca_root_dev_cert_der,
|
||||
oem_ca_root_dev_cert_der + oem_ca_root_dev_cert_der_len),
|
||||
oem_root_prod_certificate_(
|
||||
oem_ca_root_prod_cert_der,
|
||||
oem_ca_root_prod_cert_der + oem_ca_root_prod_cert_der_len) {}
|
||||
|
||||
RootCertificates::~RootCertificates() {}
|
||||
|
||||
} // namespace widevine
|
||||
@@ -1,56 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// 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.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PROVISIONING_SDK_INTERNAL_CERTIFICATES_ROOT_CERTIFICATES_H_
|
||||
#define PROVISIONING_SDK_INTERNAL_CERTIFICATES_ROOT_CERTIFICATES_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace widevine {
|
||||
|
||||
// This class contains DRM and OEM root certificates.
|
||||
class RootCertificates {
|
||||
public:
|
||||
RootCertificates();
|
||||
~RootCertificates();
|
||||
|
||||
const std::string& drm_root_test_certificate() const {
|
||||
return drm_root_test_certificate_;
|
||||
}
|
||||
|
||||
const std::string& drm_root_dev_certificate() const {
|
||||
return drm_root_dev_certificate_;
|
||||
}
|
||||
|
||||
const std::string& drm_root_prod_certificate() const {
|
||||
return drm_root_prod_certificate_;
|
||||
}
|
||||
|
||||
const std::string& oem_root_dev_certificate() const {
|
||||
return oem_root_dev_certificate_;
|
||||
}
|
||||
|
||||
const std::string& oem_root_prod_certificate() const {
|
||||
return oem_root_prod_certificate_;
|
||||
}
|
||||
|
||||
private:
|
||||
RootCertificates(const RootCertificates&) = delete;
|
||||
RootCertificates& operator=(const RootCertificates&) = delete;
|
||||
|
||||
std::string drm_root_test_certificate_;
|
||||
std::string drm_root_dev_certificate_;
|
||||
std::string drm_root_prod_certificate_;
|
||||
std::string oem_root_dev_certificate_;
|
||||
std::string oem_root_prod_certificate_;
|
||||
};
|
||||
|
||||
} // namespace widevine
|
||||
|
||||
#endif // PROVISIONING_SDK_INTERNAL_CERTIFICATES_ROOT_CERTIFICATES_H_
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "provisioning_sdk/internal/certificates/root_oem_certificates.h"
|
||||
|
||||
#include "provisioning_sdk/internal/certificates/oem_ca_root_dev_cert.h"
|
||||
#include "provisioning_sdk/internal/certificates/oem_ca_root_prod_cert.h"
|
||||
|
||||
namespace widevine {
|
||||
|
||||
RootOemCertificates::RootOemCertificates()
|
||||
: oem_root_dev_certificate_(
|
||||
oem_ca_root_dev_cert_der,
|
||||
oem_ca_root_dev_cert_der + oem_ca_root_dev_cert_der_len),
|
||||
oem_root_prod_certificate_(
|
||||
oem_ca_root_prod_cert_der,
|
||||
oem_ca_root_prod_cert_der + oem_ca_root_prod_cert_der_len) {}
|
||||
|
||||
RootOemCertificates::~RootOemCertificates() {}
|
||||
|
||||
} // namespace widevine
|
||||
@@ -0,0 +1,40 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PROVISIONING_SDK_INTERNAL_CERTIFICATES_ROOT_OEM_CERTIFICATES_H_
|
||||
#define PROVISIONING_SDK_INTERNAL_CERTIFICATES_ROOT_OEM_CERTIFICATES_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace widevine {
|
||||
|
||||
// This class contains development and production OEM root certificates.
|
||||
class RootOemCertificates {
|
||||
public:
|
||||
RootOemCertificates();
|
||||
~RootOemCertificates();
|
||||
|
||||
const std::string& oem_root_dev_certificate() const {
|
||||
return oem_root_dev_certificate_;
|
||||
}
|
||||
|
||||
const std::string& oem_root_prod_certificate() const {
|
||||
return oem_root_prod_certificate_;
|
||||
}
|
||||
|
||||
private:
|
||||
RootOemCertificates(const RootOemCertificates&) = delete;
|
||||
RootOemCertificates& operator=(const RootOemCertificates&) = delete;
|
||||
|
||||
std::string oem_root_dev_certificate_;
|
||||
std::string oem_root_prod_certificate_;
|
||||
};
|
||||
|
||||
} // namespace widevine
|
||||
|
||||
#endif // PROVISIONING_SDK_INTERNAL_CERTIFICATES_ROOT_OEM_CERTIFICATES_H_
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2016 Google Inc.
|
||||
// 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.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "provisioning_sdk/internal/certificates/test_certificates.h"
|
||||
#include "provisioning_sdk/internal/certificates/test_oem_certificates.h"
|
||||
|
||||
#include "provisioning_sdk/internal/certificates/backwards_chain.h"
|
||||
#include "provisioning_sdk/internal/certificates/expired_2000_chain.h"
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace widevine {
|
||||
|
||||
TestCertificates::TestCertificates()
|
||||
TestOemCertificates::TestOemCertificates()
|
||||
: single_certificate_chain_der_(
|
||||
single_cert_chain_der,
|
||||
single_cert_chain_der + single_cert_chain_der_len),
|
||||
@@ -35,6 +35,6 @@ TestCertificates::TestCertificates()
|
||||
invalid_certificate_chain_der_(
|
||||
invalid_chain_der, invalid_chain_der + invalid_chain_der_len) {}
|
||||
|
||||
TestCertificates::~TestCertificates() {}
|
||||
TestOemCertificates::~TestOemCertificates() {}
|
||||
|
||||
} // namespace widevine
|
||||
@@ -1,24 +1,24 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2016 Google Inc.
|
||||
// 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.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PROVISIONING_SDK_INTERNAL_CERTIFICATES_TEST_CERTIFICATES_H_
|
||||
#define PROVISIONING_SDK_INTERNAL_CERTIFICATES_TEST_CERTIFICATES_H_
|
||||
#ifndef PROVISIONING_SDK_INTERNAL_CERTIFICATES_TEST_OEM_CERTIFICATES_H_
|
||||
#define PROVISIONING_SDK_INTERNAL_CERTIFICATES_TEST_OEM_CERTIFICATES_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace widevine {
|
||||
|
||||
// This class contains DER-encoded test certificates. The keys for these
|
||||
// This class contains DER-encoded test OEM certificates. The keys for these
|
||||
// certificates came from common/rsa_test_keys.h.
|
||||
class TestCertificates {
|
||||
class TestOemCertificates {
|
||||
public:
|
||||
TestCertificates();
|
||||
~TestCertificates();
|
||||
TestOemCertificates();
|
||||
~TestOemCertificates();
|
||||
|
||||
const std::string& single_certificate_chain_der() const {
|
||||
return single_certificate_chain_der_;
|
||||
@@ -45,8 +45,8 @@ class TestCertificates {
|
||||
}
|
||||
|
||||
private:
|
||||
TestCertificates(const TestCertificates&) = delete;
|
||||
TestCertificates& operator=(const TestCertificates&) = delete;
|
||||
TestOemCertificates(const TestOemCertificates&) = delete;
|
||||
TestOemCertificates& operator=(const TestOemCertificates&) = delete;
|
||||
|
||||
std::string single_certificate_chain_der_;
|
||||
// leaf + intermediate certificates.
|
||||
@@ -60,4 +60,4 @@ class TestCertificates {
|
||||
|
||||
} // namespace widevine
|
||||
|
||||
#endif // PROVISIONING_SDK_INTERNAL_CERTIFICATES_TEST_CERTIFICATES_H_
|
||||
#endif // PROVISIONING_SDK_INTERNAL_CERTIFICATES_TEST_OEM_CERTIFICATES_H_
|
||||
Reference in New Issue
Block a user