OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 #ifndef REMOTING_PROTOCOL_AUTHENTICATION_METHOD_H_ | |
5 #define REMOTING_PROTOCOL_AUTHENTICATION_METHOD_H_ | |
6 | |
7 #include <string> | |
8 | |
9 namespace remoting { | |
10 namespace protocol { | |
11 | |
12 class Authenticator; | |
13 | |
14 // AuthenticationMethod represents an authentication algorithm. | |
15 enum class AuthenticationMethod { | |
16 INVALID, | |
17 SPAKE2_SHARED_SECRET_PLAIN, | |
18 SPAKE2_SHARED_SECRET_HMAC, | |
19 SPAKE2_PAIR, | |
20 THIRD_PARTY | |
21 }; | |
22 | |
23 enum class HashFunction { | |
24 NONE, | |
25 HMAC_SHA256, | |
26 }; | |
27 | |
28 // Parses a string that defines an authentication method. Returns | |
29 // AuthenticationMethod::INVALID if the string is invalid. | |
30 AuthenticationMethod ParseAuthenticationMethodString(const std::string& value); | |
31 | |
32 // Returns string representation of |method|. | |
33 const std::string AuthenticationMethodToString(AuthenticationMethod method); | |
34 | |
35 // Returns hash function applied to the shared secret on both ends for the | |
36 // spefied |method|. | |
37 HashFunction GetHashFunctionForAuthenticationMethod( | |
38 AuthenticationMethod method); | |
39 | |
40 // Applies the specified hash function to |shared_secret| with the | |
41 // specified |tag| as a key. | |
42 std::string ApplySharedSecretHashFunction(HashFunction hash_function, | |
43 const std::string& tag, | |
44 const std::string& shared_secret); | |
45 | |
46 } // namespace protocol | |
47 } // namespace remoting | |
48 | |
49 #endif // REMOTING_PROTOCOL_AUTHENTICATION_METHOD_H_ | |
OLD | NEW |