| Index: chrome/browser/local_discovery/privetv3_crypto_provider.cc
|
| diff --git a/chrome/browser/local_discovery/privetv3_crypto_provider.cc b/chrome/browser/local_discovery/privetv3_crypto_provider.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fddf8958067b52f4a41acd65455b40b423d01ba3
|
| --- /dev/null
|
| +++ b/chrome/browser/local_discovery/privetv3_crypto_provider.cc
|
| @@ -0,0 +1,63 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/local_discovery/privetv3_crypto_provider.h"
|
| +
|
| +namespace local_discovery {
|
| +
|
| +namespace {
|
| +
|
| +// A stub session type used for development/debugging.
|
| +const char kAuthMethodEmpty[] = "empty";
|
| +}
|
| +
|
| +class PrivetV3CryptoProviderEmpty : public PrivetV3CryptoProvider {
|
| + public:
|
| + PrivetV3CryptoProviderEmpty();
|
| + virtual ~PrivetV3CryptoProviderEmpty();
|
| +
|
| + // PrivetV3CryptoProvider implementation.
|
| + virtual const std::string& GetAuthMethod() OVERRIDE;
|
| + virtual bool GetNextStep(int* step, std::string* package) OVERRIDE;
|
| + virtual bool SetStepResponse(int step, const std::string& package) OVERRIDE;
|
| + virtual bool EncryptData(const std::string& input,
|
| + std::string* output) OVERRIDE;
|
| +};
|
| +
|
| +scoped_ptr<PrivetV3CryptoProvider> Create(
|
| + const std::vector<std::string>& available_auth_methods) {
|
| + for (size_t i = 0; i < available_auth_methods.size(); i++) {
|
| + if (available_auth_methods[i] == kAuthMethodEmpty) {
|
| + return scoped_ptr<PrivetV3CryptoProvider>(
|
| + new PrivetV3CryptoProviderEmpty());
|
| + }
|
| + }
|
| +
|
| + return scoped_ptr<PrivetV3CryptoProvider>();
|
| +}
|
| +
|
| +PrivetV3CryptoProviderEmpty::PrivetV3CryptoProviderEmpty() {
|
| +}
|
| +
|
| +PrivetV3CryptoProviderEmpty::~PrivetV3CryptoProviderEmpty() {
|
| +}
|
| +
|
| +bool PrivetV3CryptoProviderEmpty::GetNextStep(int* step, std::string* package) {
|
| + *step = 0;
|
| + package->clear();
|
| + return true;
|
| +}
|
| +
|
| +bool PrivetV3CryptoProviderEmpty::SetStepResponse(int step,
|
| + const std::string& package) {
|
| + return step == 0 && package.empty();
|
| +}
|
| +
|
| +bool PrivetV3CryptoProviderEmpty::EncryptData(const std::string& input,
|
| + std::string* output) {
|
| + *output = input;
|
| + return true;
|
| +}
|
| +
|
| +} // namespace local_discovery
|
|
|