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

Side by Side Diff: components/proximity_auth/device_to_device_responder_operations.h

Issue 2502343003: Moved //components/proximity_auth/cryptauth to //components/cryptauth. (Closed)
Patch Set: Fixed proto #includes. Created 4 years, 1 month 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_PROXIMITY_AUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H 5 #ifndef COMPONENTS_PROXIMITY_AUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H
6 #define COMPONENTS_PROXIMITY_AUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H 6 #define COMPONENTS_PROXIMITY_AUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 12
13 namespace cryptauth {
14 class SecureMessageDelegate;
15 }
16
13 namespace proximity_auth { 17 namespace proximity_auth {
14 18
15 class SecureMessageDelegate;
16
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 responder is the phone. Because the responder side of this 21 // laptop, the responder is the phone. Because the responder side of this
20 // protocol does not run in Chrome, this class is implemented solely for 22 // protocol does not run in Chrome, this class is implemented solely for
21 // testing purposes. 23 // testing purposes.
22 // 24 //
23 // All operations are asynchronous because we use the SecureMessageDelegate for 25 // All operations are asynchronous because we use the SecureMessageDelegate for
24 // crypto operations, whose implementation may be asynchronous. 26 // crypto operations, whose implementation may be asynchronous.
25 // 27 //
26 // In the DeviceToDevice protocol, the responder parses two messages received 28 // In the DeviceToDevice protocol, the responder parses two messages received
(...skipping 27 matching lines...) Expand all
54 // |persistent_symmetric_key|: The long-term symmetric key that is shared by 56 // |persistent_symmetric_key|: The long-term symmetric key that is shared by
55 // the initiator and responder. 57 // the initiator and responder.
56 // |secure_message_delegate|: Delegate for SecureMessage operations. This 58 // |secure_message_delegate|: Delegate for SecureMessage operations. This
57 // instance is not owned, and must live until after |callback| is invoked. 59 // instance is not owned, and must live until after |callback| is invoked.
58 // |callback|: Invoked upon operation completion with whether 60 // |callback|: Invoked upon operation completion with whether
59 // |responder_auth_message| is validated successfully and the initiator's 61 // |responder_auth_message| is validated successfully and the initiator's
60 // public key. 62 // public key.
61 static void ValidateHelloMessage( 63 static void ValidateHelloMessage(
62 const std::string& hello_message, 64 const std::string& hello_message,
63 const std::string& persistent_symmetric_key, 65 const std::string& persistent_symmetric_key,
64 SecureMessageDelegate* secure_message_delegate, 66 cryptauth::SecureMessageDelegate* secure_message_delegate,
65 const ValidateHelloCallback& callback); 67 const ValidateHelloCallback& callback);
66 68
67 // Creates the [Responder Auth] message: 69 // Creates the [Responder Auth] message:
68 // |hello_message|: The initial [Hello] message that was sent, which is used 70 // |hello_message|: The initial [Hello] message that was sent, which is used
69 // in the signature calculation. 71 // in the signature calculation.
70 // |session_public_key|: This session public key will be stored in plaintext 72 // |session_public_key|: This session public key will be stored in plaintext
71 // to be read by the initiator. 73 // to be read by the initiator.
72 // |session_private_key|: The session private key is used in conjunction with 74 // |session_private_key|: The session private key is used in conjunction with
73 // the initiator's public key to derive the session symmetric key. 75 // the initiator's public key to derive the session symmetric key.
74 // |persistent_private_key|: The long-term private key possessed by the 76 // |persistent_private_key|: The long-term private key possessed by the
75 // responder device. 77 // responder device.
76 // |persistent_symmetric_key|: The long-term symmetric key that is shared by 78 // |persistent_symmetric_key|: The long-term symmetric key that is shared by
77 // the initiator and responder. 79 // the initiator and responder.
78 // |secure_message_delegate|: Delegate for SecureMessage operations. This 80 // |secure_message_delegate|: Delegate for SecureMessage operations. This
79 // instance is not owned, and must live until after |callback| is invoked. 81 // instance is not owned, and must live until after |callback| is invoked.
80 // |callback|: Invoked upon operation completion with the serialized message 82 // |callback|: Invoked upon operation completion with the serialized message
81 // or an empty string. 83 // or an empty string.
82 static void CreateResponderAuthMessage( 84 static void CreateResponderAuthMessage(
83 const std::string& hello_message, 85 const std::string& hello_message,
84 const std::string& session_public_key, 86 const std::string& session_public_key,
85 const std::string& session_private_key, 87 const std::string& session_private_key,
86 const std::string& persistent_private_key, 88 const std::string& persistent_private_key,
87 const std::string& persistent_symmetric_key, 89 const std::string& persistent_symmetric_key,
88 SecureMessageDelegate* secure_message_delegate, 90 cryptauth::SecureMessageDelegate* secure_message_delegate,
89 const MessageCallback& callback); 91 const MessageCallback& callback);
90 92
91 // Validates that the [Initiator Auth] message, received from the initiator, 93 // Validates that the [Initiator Auth] message, received from the initiator,
92 // is properly signed and encrypted. 94 // is properly signed and encrypted.
93 // |initiator_auth_message|: The bytes of the [Local Auth] message to 95 // |initiator_auth_message|: The bytes of the [Local Auth] message to
94 // validate. 96 // validate.
95 // |session_symmetric_key|: The derived symmetric key used just for the 97 // |session_symmetric_key|: The derived symmetric key used just for the
96 // session. 98 // session.
97 // |persistent_symmetric_key|: The long-term symmetric key that is shared by 99 // |persistent_symmetric_key|: The long-term symmetric key that is shared by
98 // the initiator and responder. 100 // the initiator and responder.
99 // |secure_message_delegate|: Delegate for SecureMessage operations. This 101 // |secure_message_delegate|: Delegate for SecureMessage operations. This
100 // instance is not owned, and must live until after |callback| is invoked. 102 // instance is not owned, and must live until after |callback| is invoked.
101 // |callback|: Invoked upon operation completion with whether 103 // |callback|: Invoked upon operation completion with whether
102 // |responder_auth_message| is validated successfully. 104 // |responder_auth_message| is validated successfully.
103 static void ValidateInitiatorAuthMessage( 105 static void ValidateInitiatorAuthMessage(
104 const std::string& initiator_auth_message, 106 const std::string& initiator_auth_message,
105 const std::string& session_symmetric_key, 107 const std::string& session_symmetric_key,
106 const std::string& persistent_symmetric_key, 108 const std::string& persistent_symmetric_key,
107 const std::string& responder_auth_message, 109 const std::string& responder_auth_message,
108 SecureMessageDelegate* secure_message_delegate, 110 cryptauth::SecureMessageDelegate* secure_message_delegate,
109 const ValidationCallback& callback); 111 const ValidationCallback& callback);
110 112
111 private: 113 private:
112 DISALLOW_IMPLICIT_CONSTRUCTORS(DeviceToDeviceResponderOperations); 114 DISALLOW_IMPLICIT_CONSTRUCTORS(DeviceToDeviceResponderOperations);
113 }; 115 };
114 116
115 } // proximity_auth 117 } // proximity_auth
116 118
117 #endif // COMPONENTS_PROXIMITY_AUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H 119 #endif // COMPONENTS_PROXIMITY_AUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698