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

Side by Side Diff: components/cryptauth/device_to_device_initiator_operations.h

Issue 2899863002: Updating D2D protocol to v1 to support separate sequence numbers. (Closed)
Patch Set: Addressing comments Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_INITIATOR_OPERATIONS_H_ 5 #ifndef COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_INITIATOR_OPERATIONS_H_
6 #define COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_INITIATOR_OPERATIONS_H_ 6 #define COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_INITIATOR_OPERATIONS_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/cryptauth/session_keys.h"
12 14
13 namespace cryptauth { 15 namespace cryptauth {
14 16
15 class SecureMessageDelegate; 17 class SecureMessageDelegate;
16 18
17 // Utility class containing operations in the DeviceToDevice protocol that the 19 // Utility class containing operations in the DeviceToDevice protocol that the
18 // initiator needs to perform. For Smart Lock, in which a phone unlocks a 20 // initiator needs to perform. For Smart Lock, in which a phone unlocks a
19 // laptop, the initiator is laptop. 21 // laptop, the initiator is laptop.
20 // 22 //
21 // All operations are asynchronous because we use the SecureMessageDelegate for 23 // All operations are asynchronous because we use the SecureMessageDelegate for
(...skipping 14 matching lines...) Expand all
36 class DeviceToDeviceInitiatorOperations { 38 class DeviceToDeviceInitiatorOperations {
37 public: 39 public:
38 // Callback for operations that create a message. Invoked with the serialized 40 // Callback for operations that create a message. Invoked with the serialized
39 // SecureMessage upon success or the empty string upon failure. 41 // SecureMessage upon success or the empty string upon failure.
40 typedef base::Callback<void(const std::string&)> MessageCallback; 42 typedef base::Callback<void(const std::string&)> MessageCallback;
41 43
42 // Callback for ValidateResponderAuthMessage. The first argument will be 44 // Callback for ValidateResponderAuthMessage. The first argument will be
43 // called with the validation outcome. If validation succeeded, then the 45 // called with the validation outcome. If validation succeeded, then the
44 // second argument will contain the session symmetric key derived from the 46 // second argument will contain the session symmetric key derived from the
45 // [Responder Auth] message. 47 // [Responder Auth] message.
46 typedef base::Callback<void(bool, const std::string&)> 48 typedef base::Callback<void(bool, const SessionKeys&)>
47 ValidateResponderAuthCallback; 49 ValidateResponderAuthCallback;
48 50
49 // Creates the [Hello] message, which is the first message that is sent: 51 // Creates the [Hello] message, which is the first message that is sent:
50 // |session_public_key|: This session public key will be stored in plaintext 52 // |session_public_key|: This session public key will be stored in plaintext
51 // (but signed) so the responder can parse it. 53 // (but signed) so the responder can parse it.
52 // |persistent_symmetric_key|: The long-term symmetric key that is shared by 54 // |persistent_symmetric_key|: The long-term symmetric key that is shared by
53 // the initiator and responder. 55 // the initiator and responder.
54 // |secure_message_delegate|: Delegate for SecureMessage operations. This 56 // |secure_message_delegate|: Delegate for SecureMessage operations. This
55 // instance is not owned, and must live until after |callback| is invoked. 57 // instance is not owned, and must live until after |callback| is invoked.
56 // |callback|: Invoked upon operation completion with the serialized message 58 // |callback|: Invoked upon operation completion with the serialized message
(...skipping 25 matching lines...) Expand all
82 const std::string& responder_auth_message, 84 const std::string& responder_auth_message,
83 const std::string& persistent_responder_public_key, 85 const std::string& persistent_responder_public_key,
84 const std::string& persistent_symmetric_key, 86 const std::string& persistent_symmetric_key,
85 const std::string& session_private_key, 87 const std::string& session_private_key,
86 const std::string& hello_message, 88 const std::string& hello_message,
87 SecureMessageDelegate* secure_message_delegate, 89 SecureMessageDelegate* secure_message_delegate,
88 const ValidateResponderAuthCallback& callback); 90 const ValidateResponderAuthCallback& callback);
89 91
90 // Creates the [Initiator Auth] message, which allows the responder to 92 // Creates the [Initiator Auth] message, which allows the responder to
91 // authenticate the initiator: 93 // authenticate the initiator:
94 // |session_keys|: The session symmetric keys.
92 // |persistent_symmetric_key|: The long-term symmetric key that is shared by 95 // |persistent_symmetric_key|: The long-term symmetric key that is shared by
93 // the initiator and responder. 96 // the initiator and responder.
94 // |responder_auth_message|: The [Responder Auth] message sent previously to 97 // |responder_auth_message|: The [Responder Auth] message sent previously to
95 // the responder. These bytes are used in the signature calculation. 98 // the responder. These bytes are used in the signature calculation.
96 // |secure_message_delegate|: Delegate for SecureMessage operations. This 99 // |secure_message_delegate|: Delegate for SecureMessage operations. This
97 // instance is not owned, and must live until after |callback| is invoked. 100 // instance is not owned, and must live until after |callback| is invoked.
98 // |callback|: Invoked upon operation completion with the serialized message 101 // |callback|: Invoked upon operation completion with the serialized message
99 // or an empty string. 102 // or an empty string.
100 static void CreateInitiatorAuthMessage( 103 static void CreateInitiatorAuthMessage(
101 const std::string& session_symmetric_key, 104 const SessionKeys& session_keys,
102 const std::string& persistent_symmetric_key, 105 const std::string& persistent_symmetric_key,
103 const std::string& responder_auth_message, 106 const std::string& responder_auth_message,
104 SecureMessageDelegate* secure_message_delegate, 107 SecureMessageDelegate* secure_message_delegate,
105 const MessageCallback& callback); 108 const MessageCallback& callback);
106 109
107 private: 110 private:
108 DISALLOW_IMPLICIT_CONSTRUCTORS(DeviceToDeviceInitiatorOperations); 111 DISALLOW_IMPLICIT_CONSTRUCTORS(DeviceToDeviceInitiatorOperations);
109 }; 112 };
110 113
111 } // cryptauth 114 } // cryptauth
112 115
113 #endif // COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_INITIATOR_OPERATIONS_H_ 116 #endif // COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_INITIATOR_OPERATIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698