Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: chrome/browser/local_discovery/privetv3_crypto_provider.h

Issue 316873004: Interface plus stub implementation for PrivetV3CryptoProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privetv3_crypto_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 enum HandshakeState {
18 // Handshake still in progress. Call |GetNextStep| to send next handshake
19 // step.
20 IN_PROGRESS,
21 // Handshake in progress, waiting for response. Call |SetStepResponse| to
22 // set the step response.
23 AWAITING_RESPONSE,
24 // Handshake in progress, need to wait for user verification to
25 // continue. Call |GetVerificationCode| to get the verification code and
26 // |AcceptVerificationCode| to signify the code is accepted.
27 AWAITING_USER_VERIFICATION,
28 // Handshake complete. Call |EncryptData| to encrypt the data.
29 COMPLETE,
30 // Handshake error.
31 ERROR
Vitaly Buka (NO REVIEWS) 2014/06/06 17:33:30 ERROR -> HANDSHAKE_ERROR or something else there i
Noam Samuel 2014/06/06 21:57:36 Done.
32 };
33
34 virtual ~PrivetV3CryptoProvider() {}
35
36 static scoped_ptr<PrivetV3CryptoProvider> Create(
37 const std::vector<std::string>& available_auth_methods);
38
39 // Return the current state of the crypto provider.
40 virtual HandshakeState GetState() = 0;
41
42 // Return the authentication method used.
43 virtual std::string GetAuthMethod() = 0;
44
45 // Get the next handshake command. |step| is the step number to send,
46 // |package| is a base64-encoded package to send with the step. Return
47 // |true| if a package is generated or |false| in case of an error.
48 virtual HandshakeState GetNextStep(int* step, std::string* package) = 0;
49
50 // Input the response to the handshake command. |step| is the received step
51 // number, |state| is the received state string, |package| is the received
52 // base64-encoded package. Return the current handshake state.
53 virtual HandshakeState SetStepResponse(int step,
54 const std::string& state,
55 const std::string& package) = 0;
56
57 // Get the verification code to be displayed on the screen.
58 virtual std::string GetVerificationCode() = 0;
59
60 // Signal that the verification code is accepted. Returns the current
61 // handshake state.
62 virtual HandshakeState AcceptVerificationCode() = 0;
63
64 // Encrypt a string using the session key.
65 virtual bool EncryptData(const std::string& input, std::string* output) = 0;
66 };
67
68 } // namespace local_discovery
69
70 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVETV3_CRYPTO_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privetv3_crypto_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698