OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_CRYPTO_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_CRYPTO_PROVIDER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 namespace local_discovery { |
| 14 |
| 15 class PrivetV3CryptoProvider { |
| 16 public: |
| 17 virtual ~PrivetV3CryptoProvider() {} |
| 18 |
| 19 static scoped_ptr<PrivetV3CryptoProvider> Create( |
| 20 const std::vector<std::string>& available_auth_methods); |
| 21 |
| 22 // Return the authentication method used. |
| 23 virtual const std::string& GetAuthMethod() = 0; |
| 24 |
| 25 // Get the next handshake command. |step| is the step number to send, |
| 26 // |package| is a base64-encoded package to send with the step. Return |
| 27 // |true| if a package is generated or |false| in case of an error. |
| 28 virtual bool GetNextStep(int* step, std::string* package) = 0; |
| 29 |
| 30 // Input the response to the handshake command. |step| is the received step |
| 31 // number, |package| is the received base64-encoded package. Return |true| if |
| 32 // the step was successfully processed or |false| in case of an error. |
| 33 virtual bool SetStepResponse(int step, const std::string& package) = 0; |
| 34 |
| 35 // Encrypt a string using the session key. |
| 36 virtual bool EncryptData(const std::string& input, std::string* output) = 0; |
| 37 }; |
| 38 |
| 39 } // namespace local_discovery |
| 40 |
| 41 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_CRYPTO_PROVIDER_H_ |
OLD | NEW |