| OLD | NEW |
| 1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009-2010 The Chromium OS 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 // Credentials is the interface for objects that wrap up a set | 5 // Credentials is the interface for objects that wrap up a set |
| 6 // of credentials with which we can authenticate or mount. | 6 // of credentials with which we can authenticate or mount. |
| 7 | 7 |
| 8 #ifndef CRYPTOHOME_CREDENTIALS_H_ | 8 #ifndef CRYPTOHOME_CREDENTIALS_H_ |
| 9 #define CRYPTOHOME_CREDENTIALS_H_ | 9 #define CRYPTOHOME_CREDENTIALS_H_ |
| 10 | 10 |
| 11 #include "chromeos/utility.h" | 11 #include "cryptohome/secure_blob.h" |
| 12 | 12 |
| 13 namespace cryptohome { | 13 namespace cryptohome { |
| 14 | 14 |
| 15 class Credentials { | 15 class Credentials { |
| 16 public: | 16 public: |
| 17 Credentials() {} | 17 Credentials() {} |
| 18 virtual ~Credentials() {} | 18 virtual ~Credentials() {} |
| 19 | 19 |
| 20 // Returns the full user name, including any '@' sign or domain name. | 20 // Returns the full user name, including any '@' sign or domain name. |
| 21 // | 21 // |
| 22 // Parameters | 22 // Parameters |
| 23 // name_buffer - Output buffer. | 23 // name_buffer - Output buffer. |
| 24 // length - Amount of space in name_buffer | 24 // length - Amount of space in name_buffer |
| 25 // | 25 // |
| 26 virtual void GetFullUsername(char *name_buffer, int length) const = 0; | 26 virtual void GetFullUsername(char *name_buffer, int length) const = 0; |
| 27 | 27 |
| 28 // Returns the full user name as a std::string |
| 29 virtual std::string GetFullUsername() const = 0; |
| 30 |
| 28 // Returns the part of the username before the '@' | 31 // Returns the part of the username before the '@' |
| 29 // | 32 // |
| 30 // Parameters | 33 // Parameters |
| 31 // name_buffer - Output buffer. | 34 // name_buffer - Output buffer. |
| 32 // length - Amount of space in name_buffer | 35 // length - Amount of space in name_buffer |
| 33 // | 36 // |
| 34 virtual void GetPartialUsername(char *name_buffer, int length) const = 0; | 37 virtual void GetPartialUsername(char *name_buffer, int length) const = 0; |
| 35 | 38 |
| 36 // Returns the obfuscated username, used as the name of the directory | 39 // Returns the obfuscated username, used as the name of the directory |
| 37 // containing the user's stateful data (and maybe used for other reasons | 40 // containing the user's stateful data (and maybe used for other reasons |
| 38 // at some point.) | 41 // at some point.) |
| 39 virtual std::string GetObfuscatedUsername( | 42 virtual std::string GetObfuscatedUsername( |
| 40 const chromeos::Blob &system_salt) const = 0; | 43 const chromeos::Blob &system_salt) const = 0; |
| 41 | 44 |
| 42 // Returns a "weak hash" of the user's password. Requires the system | 45 // Returns a the user's passkey |
| 43 // salt to compute. | |
| 44 // | |
| 45 // This hashes using the same algorithm that pam/pam_google/pam_mount use to | |
| 46 // get the user's plaintext password passed on to the login session. The | |
| 47 // two hashing algorithms must be kept in sync, as the hash is used to derive | |
| 48 // a passphrase for the master key. | |
| 49 // | |
| 50 // Parameters | |
| 51 // system_salt - A blob containing the current system salt value. | |
| 52 // | 46 // |
| 53 // Returns | 47 // Returns |
| 54 // A std::string containing the weak hash encoded as a hex sequence in ASCII. | 48 // A SecureBlob containing the passkey |
| 55 // | 49 // |
| 56 virtual std::string GetPasswordWeakHash( | 50 virtual SecureBlob GetPasskey() const = 0; |
| 57 const chromeos::Blob &system_salt) const = 0; | |
| 58 }; | 51 }; |
| 59 | 52 |
| 60 } // namespace cryptohome | 53 } // namespace cryptohome |
| 61 | 54 |
| 62 #endif // CRYPTOHOME_CREDENTIALS_H_ | 55 #endif // CRYPTOHOME_CREDENTIALS_H_ |
| OLD | NEW |