Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1266)

Unified Diff: chrome/browser/sync/util/nigori.h

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/util/logging.cc ('k') | chrome/browser/sync/util/nigori.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/util/nigori.h
diff --git a/chrome/browser/sync/util/nigori.h b/chrome/browser/sync/util/nigori.h
deleted file mode 100644
index 74fd6ece8d70877a721a8ea3cc01edc378d6e709..0000000000000000000000000000000000000000
--- a/chrome/browser/sync/util/nigori.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2011 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_SYNC_UTIL_NIGORI_H_
-#define CHROME_BROWSER_SYNC_UTIL_NIGORI_H_
-#pragma once
-
-#include <string>
-
-#include "base/memory/scoped_ptr.h"
-#include "crypto/symmetric_key.h"
-
-namespace browser_sync {
-
-// A (partial) implementation of Nigori, a protocol to securely store secrets in
-// the cloud. This implementation does not support server authentication or
-// assisted key derivation.
-//
-// To store secrets securely, use the |Permute| method to derive a lookup name
-// for your secret (basically a map key), and |Encrypt| and |Decrypt| to store
-// and retrieve the secret.
-//
-// TODO: Link to doc.
-class Nigori {
- public:
- enum Type {
- Password = 1,
- };
-
- Nigori();
- virtual ~Nigori();
-
- // Initialize the client with the given |hostname|, |username| and |password|.
- bool InitByDerivation(const std::string& hostname,
- const std::string& username,
- const std::string& password);
-
- // Initialize the client by importing the given keys instead of deriving new
- // ones.
- bool InitByImport(const std::string& user_key,
- const std::string& encryption_key,
- const std::string& mac_key);
-
- // Derives a secure lookup name from |type| and |name|. If |hostname|,
- // |username| and |password| are kept constant, a given |type| and |name| pair
- // always yields the same |permuted| value. Note that |permuted| will be
- // Base64 encoded.
- bool Permute(Type type, const std::string& name, std::string* permuted) const;
-
- // Encrypts |value|. Note that on success, |encrypted| will be Base64
- // encoded.
- bool Encrypt(const std::string& value, std::string* encrypted) const;
-
- // Decrypts |value| into |decrypted|. It is assumed that |value| is Base64
- // encoded.
- bool Decrypt(const std::string& value, std::string* decrypted) const;
-
- // Exports the raw derived keys.
- bool ExportKeys(std::string* user_key,
- std::string* encryption_key,
- std::string* mac_key) const;
-
- static const char kSaltSalt[]; // The salt used to derive the user salt.
- static const size_t kSaltKeySizeInBits = 128;
- static const size_t kDerivedKeySizeInBits = 128;
- static const size_t kIvSize = 16;
- static const size_t kHashSize = 32;
-
- static const size_t kSaltIterations = 1001;
- static const size_t kUserIterations = 1002;
- static const size_t kEncryptionIterations = 1003;
- static const size_t kSigningIterations = 1004;
-
- private:
- scoped_ptr<crypto::SymmetricKey> user_key_;
- scoped_ptr<crypto::SymmetricKey> encryption_key_;
- scoped_ptr<crypto::SymmetricKey> mac_key_;
-};
-
-} // namespace browser_sync
-
-#endif // CHROME_BROWSER_SYNC_UTIL_NIGORI_H_
« no previous file with comments | « chrome/browser/sync/util/logging.cc ('k') | chrome/browser/sync/util/nigori.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698