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

Side by Side Diff: chrome/browser/chromeos/platform_keys/platform_keys_service.h

Issue 331173002: enterprise.platformKeys: Respect the 'hash' argument of generateKey. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium 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 CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/chromeos/platform_keys/platform_keys.h"
14 #include "components/keyed_service/core/keyed_service.h" 15 #include "components/keyed_service/core/keyed_service.h"
15 16
16 namespace content { 17 namespace content {
17 class BrowserContext; 18 class BrowserContext;
18 } 19 }
19 20
20 namespace base { 21 namespace base {
21 class ListValue; 22 class ListValue;
22 class Value; 23 class Value;
23 } 24 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 unsigned int modulus_length_bits, 60 unsigned int modulus_length_bits,
60 const std::string& extension_id, 61 const std::string& extension_id,
61 const GenerateKeyCallback& callback); 62 const GenerateKeyCallback& callback);
62 63
63 // If signing was successful, |signature| will be contain the signature and 64 // If signing was successful, |signature| will be contain the signature and
64 // |error_message| will be empty. If it failed, |signature| will be empty and 65 // |error_message| will be empty. If it failed, |signature| will be empty and
65 // |error_message| contain an error message. 66 // |error_message| contain an error message.
66 typedef base::Callback<void(const std::string& signature, 67 typedef base::Callback<void(const std::string& signature,
67 const std::string& error_message)> SignCallback; 68 const std::string& error_message)> SignCallback;
68 69
69 // Signs |data| with the private key matching |public_key_spki_der|, if that 70 // Digests |data| with |hash_algorithm| and afterwards signs the digest with
70 // key is stored in the given token and wasn't used for signing before. 71 // the private key matching |public_key_spki_der|, if that key is stored in
72 // the given token and wasn't used for signing before.
71 // Unregisters the key so that every future attempt to sign data with this key 73 // Unregisters the key so that every future attempt to sign data with this key
72 // is rejected. |token_id| is currently ignored, instead the user token 74 // is rejected. |token_id| is currently ignored, instead the user token
73 // associated with |browser_context| is always used. |public_key_spki_der| 75 // associated with |browser_context| is always used. |public_key_spki_der|
74 // must be the DER encoding of a SubjectPublicKeyInfo. |callback| will be 76 // must be the DER encoding of a SubjectPublicKeyInfo. |callback| will be
75 // invoked with the signature or an error message. Currently supports RSA keys 77 // invoked with the signature or an error message. Currently supports RSA keys
76 // only. 78 // only.
77 // Will only call back during the lifetime of this object. 79 // Will only call back during the lifetime of this object.
78 void Sign(const std::string& token_id, 80 void Sign(const std::string& token_id,
79 const std::string& public_key_spki_der, 81 const std::string& public_key_spki_der,
82 platform_keys::HashAlgorithm hash_algorithm,
80 const std::string& data, 83 const std::string& data,
81 const std::string& extension_id, 84 const std::string& extension_id,
82 const SignCallback& callback); 85 const SignCallback& callback);
83 86
84 private: 87 private:
85 typedef base::Callback<void(scoped_ptr<base::ListValue> platform_keys)> 88 typedef base::Callback<void(scoped_ptr<base::ListValue> platform_keys)>
86 GetPlatformKeysCallback; 89 GetPlatformKeysCallback;
87 90
88 // Registers the given public key as newly generated key, which is allowed to 91 // Registers the given public key as newly generated key, which is allowed to
89 // be used for signing for a single time. Afterwards, calls |callback|. If 92 // be used for signing for a single time. Afterwards, calls |callback|. If
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 content::BrowserContext* browser_context_; 147 content::BrowserContext* browser_context_;
145 extensions::StateStore* state_store_; 148 extensions::StateStore* state_store_;
146 base::WeakPtrFactory<PlatformKeysService> weak_factory_; 149 base::WeakPtrFactory<PlatformKeysService> weak_factory_;
147 150
148 DISALLOW_COPY_AND_ASSIGN(PlatformKeysService); 151 DISALLOW_COPY_AND_ASSIGN(PlatformKeysService);
149 }; 152 };
150 153
151 } // namespace chromeos 154 } // namespace chromeos
152 155
153 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ 156 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698