| 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 #ifndef VAULT_KEYSET_H_ | 5 #ifndef VAULT_KEYSET_H_ |
| 6 #define VAULT_KEYSET_H_ | 6 #define VAULT_KEYSET_H_ |
| 7 | 7 |
| 8 #include "cryptohome/entropy_source.h" | 8 #include <base/basictypes.h> |
| 9 #include "cryptohome/secure_blob.h" | 9 |
| 10 #include "entropy_source.h" |
| 11 #include "secure_blob.h" |
| 10 | 12 |
| 11 namespace cryptohome { | 13 namespace cryptohome { |
| 12 | 14 |
| 13 const char kVaultKeysetSignature[] = "ch"; | 15 const char kVaultKeysetSignature[] = "ch"; |
| 14 | 16 |
| 15 #define CRYPTOHOME_VAULT_KEYSET_VERSION_MAJOR 1 | 17 #define CRYPTOHOME_VAULT_KEYSET_VERSION_MAJOR 1 |
| 16 #define CRYPTOHOME_VAULT_KEYSET_VERSION_MINOR 0 | 18 #define CRYPTOHOME_VAULT_KEYSET_VERSION_MINOR 0 |
| 17 | 19 |
| 18 // VaultKeyset holds the File Encryption Key (FEK) and File Name Encryption Key | 20 // VaultKeyset holds the File Encryption Key (FEK) and File Name Encryption Key |
| 19 // (FNEK) and their corresponding signatures. | 21 // (FNEK) and their corresponding signatures. |
| 20 class VaultKeyset { | 22 class VaultKeyset { |
| 21 public: | 23 public: |
| 22 VaultKeyset(); | 24 VaultKeyset(); |
| 23 VaultKeyset(const SecureBlob& source); | |
| 24 | 25 |
| 25 bool AssignBuffer(const SecureBlob& buffer); | 26 bool AssignBuffer(const SecureBlob& buffer); |
| 26 SecureBlob ToBuffer() const; | 27 bool ToBuffer(SecureBlob* buffer) const; |
| 27 | 28 |
| 28 void CreateRandom(const EntropySource& entropy_source); | 29 void CreateRandom(const EntropySource& entropy_source); |
| 29 | 30 |
| 30 const SecureBlob& FEK() const; | 31 const SecureBlob& FEK() const; |
| 31 const SecureBlob& FEK_SIG() const; | 32 const SecureBlob& FEK_SIG() const; |
| 32 const SecureBlob& FEK_SALT() const; | 33 const SecureBlob& FEK_SALT() const; |
| 33 const SecureBlob& FNEK() const; | 34 const SecureBlob& FNEK() const; |
| 34 const SecureBlob& FNEK_SIG() const; | 35 const SecureBlob& FNEK_SIG() const; |
| 35 const SecureBlob& FNEK_SALT() const; | 36 const SecureBlob& FNEK_SALT() const; |
| 36 | 37 |
| 37 static unsigned int SerializedSize(); | 38 static unsigned int SerializedSize(); |
| 38 | 39 |
| 39 private: | 40 private: |
| 41 |
| 40 SecureBlob fek_; | 42 SecureBlob fek_; |
| 41 SecureBlob fek_sig_; | 43 SecureBlob fek_sig_; |
| 42 SecureBlob fek_salt_; | 44 SecureBlob fek_salt_; |
| 43 SecureBlob fnek_; | 45 SecureBlob fnek_; |
| 44 SecureBlob fnek_sig_; | 46 SecureBlob fnek_sig_; |
| 45 SecureBlob fnek_salt_; | 47 SecureBlob fnek_salt_; |
| 46 unsigned short major_version_; | 48 unsigned short major_version_; |
| 47 unsigned short minor_version_; | 49 unsigned short minor_version_; |
| 48 | 50 |
| 49 DISALLOW_COPY_AND_ASSIGN(VaultKeyset); | 51 DISALLOW_COPY_AND_ASSIGN(VaultKeyset); |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 } // cryptohome | 54 } // namespace cryptohome |
| 53 | 55 |
| 54 #endif // VAULT_KEYSET_H_ | 56 #endif // VAULT_KEYSET_H_ |
| OLD | NEW |