| OLD | NEW |
| 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_RESPONDER_OPERATIONS_H_ | 5 #ifndef COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H_ |
| 6 #define COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H_ | 6 #define COMPONENTS_CRYPTAUTH_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 { | 13 namespace cryptauth { |
| 14 | 14 |
| 15 class SecureMessageDelegate; | 15 class SecureMessageDelegate; |
| 16 class SessionKeys; |
| 16 | 17 |
| 17 // Utility class containing operations in the DeviceToDevice protocol that the | 18 // Utility class containing operations in the DeviceToDevice protocol that the |
| 18 // initiator needs to perform. For Smart Lock, in which a phone unlocks a | 19 // 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 | 20 // 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 | 21 // protocol does not run in Chrome, this class is implemented solely for |
| 21 // testing purposes. | 22 // testing purposes. |
| 22 // | 23 // |
| 23 // All operations are asynchronous because we use the SecureMessageDelegate for | 24 // All operations are asynchronous because we use the SecureMessageDelegate for |
| 24 // crypto operations, whose implementation may be asynchronous. | 25 // crypto operations, whose implementation may be asynchronous. |
| 25 // | 26 // |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const std::string& session_private_key, | 86 const std::string& session_private_key, |
| 86 const std::string& persistent_private_key, | 87 const std::string& persistent_private_key, |
| 87 const std::string& persistent_symmetric_key, | 88 const std::string& persistent_symmetric_key, |
| 88 SecureMessageDelegate* secure_message_delegate, | 89 SecureMessageDelegate* secure_message_delegate, |
| 89 const MessageCallback& callback); | 90 const MessageCallback& callback); |
| 90 | 91 |
| 91 // Validates that the [Initiator Auth] message, received from the initiator, | 92 // Validates that the [Initiator Auth] message, received from the initiator, |
| 92 // is properly signed and encrypted. | 93 // is properly signed and encrypted. |
| 93 // |initiator_auth_message|: The bytes of the [Local Auth] message to | 94 // |initiator_auth_message|: The bytes of the [Local Auth] message to |
| 94 // validate. | 95 // validate. |
| 95 // |session_symmetric_key|: The derived symmetric key used just for the | 96 // |session_keys|: The derived symmetric keys used just for the session. |
| 96 // session. | |
| 97 // |persistent_symmetric_key|: The long-term symmetric key that is shared by | 97 // |persistent_symmetric_key|: The long-term symmetric key that is shared by |
| 98 // the initiator and responder. | 98 // the initiator and responder. |
| 99 // |secure_message_delegate|: Delegate for SecureMessage operations. This | 99 // |secure_message_delegate|: Delegate for SecureMessage operations. This |
| 100 // 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. |
| 101 // |callback|: Invoked upon operation completion with whether | 101 // |callback|: Invoked upon operation completion with whether |
| 102 // |responder_auth_message| is validated successfully. | 102 // |responder_auth_message| is validated successfully. |
| 103 static void ValidateInitiatorAuthMessage( | 103 static void ValidateInitiatorAuthMessage( |
| 104 const std::string& initiator_auth_message, | 104 const std::string& initiator_auth_message, |
| 105 const std::string& session_symmetric_key, | 105 SessionKeys* session_keys, |
| 106 const std::string& persistent_symmetric_key, | 106 const std::string& persistent_symmetric_key, |
| 107 const std::string& responder_auth_message, | 107 const std::string& responder_auth_message, |
| 108 SecureMessageDelegate* secure_message_delegate, | 108 SecureMessageDelegate* secure_message_delegate, |
| 109 const ValidationCallback& callback); | 109 const ValidationCallback& callback); |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 DISALLOW_IMPLICIT_CONSTRUCTORS(DeviceToDeviceResponderOperations); | 112 DISALLOW_IMPLICIT_CONSTRUCTORS(DeviceToDeviceResponderOperations); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // cryptauth | 115 } // cryptauth |
| 116 | 116 |
| 117 #endif // COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H_ | 117 #endif // COMPONENTS_CRYPTAUTH_DEVICE_TO_DEVICE_RESPONDER_OPERATIONS_H_ |
| OLD | NEW |