Chromium Code Reviews| Index: chrome/browser/managed_mode/managed_user_passphrase.h |
| diff --git a/chrome/browser/managed_mode/managed_user_passphrase.h b/chrome/browser/managed_mode/managed_user_passphrase.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f27e21a1fa165c04369efabc53a193e770602bc3 |
| --- /dev/null |
| +++ b/chrome/browser/managed_mode/managed_user_passphrase.h |
| @@ -0,0 +1,37 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_PASSPHRASE_H_ |
| +#define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_PASSPHRASE_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| + |
| +// This class can be used to derive a hash of a provided passphrase. When an |
| +// empty salt is given as parameter to the constructor, a new salt is |
| +// generated randomly, which can be accessed through the |GetSalt| method. |
| +class ManagedUserPassphrase { |
| + public: |
| + explicit ManagedUserPassphrase(const std::string& salt); |
| + ~ManagedUserPassphrase(); |
| + |
| + std::string GetSalt(); |
|
Bernhard Bauer
2013/01/08 17:43:14
Newlines before comments would be nice.
Adrian Kuegel
2013/01/09 12:10:05
Done.
|
| + // This function generates a hash from a passphrase, which should be provided |
| + // as the first parameter. On return, the second parameter will contain the |
| + // Base64-encoded hash of the password. |
| + void GenerateHashFromPassphrase(const std::string& passphrase, |
| + std::string* encoded_passphrase_hash); |
|
Bernhard Bauer
2013/01/08 17:43:14
Align the parameter please.
Adrian Kuegel
2013/01/09 12:10:05
Done.
|
| + |
| + private: |
| + void GetPassphraseHash(const std::string& passphrase, |
| + std::string* passphrase_hash); |
|
Bernhard Bauer
2013/01/08 17:43:14
Align please.
Adrian Kuegel
2013/01/09 12:10:05
Done.
|
| + void GenerateRandomSalt(); |
| + |
| + std::string salt_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ManagedUserPassphrase); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_PASSPHRASE_H_ |