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
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user