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
|
||||
|
||||
Binary file not shown.
BIN
example/example_data/device.private
Normal file
BIN
example/example_data/device.private
Normal file
Binary file not shown.
BIN
example/example_data/device.public
Normal file
BIN
example/example_data/device.public
Normal file
Binary file not shown.
BIN
example/example_data/intermediate.cert
Normal file
BIN
example/example_data/intermediate.cert
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
example/example_data/provisioner.public
Normal file
BIN
example/example_data/provisioner.public
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
@@ -12,15 +12,16 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "provisioning_sdk/public/certificate_type.h"
|
||||
#include "common/certificate_type.h"
|
||||
#include "provisioning_sdk/public/provisioning_engine.h"
|
||||
#include "provisioning_sdk/public/provisioning_session.h"
|
||||
#include "provisioning_sdk/public/provisioning_status.h"
|
||||
|
||||
using widevine::kCertificateTypeTesting;
|
||||
using widevine::OK;
|
||||
using widevine::ProvisioningEngine;
|
||||
using widevine::ProvisioningSession;
|
||||
using widevine::kCertTesting;
|
||||
using widevine::SignedProvisioningMessage;
|
||||
|
||||
std::string GetContents(const std::string& file_name) {
|
||||
if (file_name.empty()) {
|
||||
@@ -42,7 +43,7 @@ std::string GetContents(const std::string& file_name) {
|
||||
}
|
||||
if (!feof(file)) std::cout << "Failed to read all file contents.";
|
||||
fclose(file);
|
||||
return contents;;
|
||||
return contents;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@@ -50,7 +51,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
// Call Initialize to setup the engine.
|
||||
if (engine.Initialize(
|
||||
kCertTesting, GetContents("example_data/service.cert"),
|
||||
kCertificateTypeTesting, GetContents("example_data/service.cert"),
|
||||
GetContents("example_data/service.encrypted.private"),
|
||||
GetContents("example_data/service.passphrase"),
|
||||
GetContents("example_data/provisioner.cert"),
|
||||
@@ -95,8 +96,9 @@ int main(int argc, char** argv) {
|
||||
// message is processed successfully; if ProcessMessage fails, they can be
|
||||
// reused on another session.
|
||||
std::unique_ptr<ProvisioningSession> session;
|
||||
if (engine.NewProvisioningSession(GetContents("example_data/user.public"),
|
||||
GetContents("example_data/user.private"),
|
||||
if (engine.NewProvisioningSession(SignedProvisioningMessage::PROVISIONING_30,
|
||||
GetContents("example_data/device.public"),
|
||||
GetContents("example_data/device.private"),
|
||||
&session) != OK) {
|
||||
std::cout << "Failed to create session." << std::endl;
|
||||
return 1;
|
||||
|
||||
@@ -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
|
||||
@@ -21,12 +21,13 @@
|
||||
DEFINE_string(service_public_key_path, "example_data/service.public",
|
||||
"Indicates the file path to service public key. If omitted, the "
|
||||
"token is not encrypted.");
|
||||
DEFINE_string(
|
||||
certificate_path, "",
|
||||
"Indicates the file path to the certificate chain. Should not be empty.");
|
||||
DEFINE_string(certificate_private_key_path, "",
|
||||
"Indicaets the file path to the certificate private key. Should "
|
||||
DEFINE_string(certificate_path, "",
|
||||
"Indicates the file path to the OEM certificate chain. Should "
|
||||
"not be empty.");
|
||||
DEFINE_string(
|
||||
certificate_private_key_path, "",
|
||||
"Indicates the file path to the OEM certificate private key. Should "
|
||||
"not be empty.");
|
||||
DEFINE_string(
|
||||
output_path, "",
|
||||
"Specifies where to write the output message. Should not be empty.");
|
||||
@@ -71,9 +72,9 @@ bool GenerateProvisioningMessage(const std::string& service_public_key,
|
||||
|
||||
} // namespace widevine
|
||||
|
||||
using widevine::GenerateProvisioningMessage;
|
||||
using widevine::GetContents;
|
||||
using widevine::SetContents;
|
||||
using widevine::GenerateProvisioningMessage;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
Reference in New Issue
Block a user