OLD | NEW |
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 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 // the list of public keys that are valid to be used for signing. Each key can | 41 // the list of public keys that are valid to be used for signing. Each key can |
42 // be used for signing at most once. | 42 // be used for signing at most once. |
43 // The format written to |state_store| is: | 43 // The format written to |state_store| is: |
44 // kStateStorePlatformKeys maps to a list of strings. | 44 // kStateStorePlatformKeys maps to a list of strings. |
45 // Each string is the base64 encoding of the DER representation of a public | 45 // Each string is the base64 encoding of the DER representation of a public |
46 // key's SPKI. | 46 // key's SPKI. |
47 explicit PlatformKeysService(content::BrowserContext* browser_context, | 47 explicit PlatformKeysService(content::BrowserContext* browser_context, |
48 extensions::StateStore* state_store); | 48 extensions::StateStore* state_store); |
49 ~PlatformKeysService() override; | 49 ~PlatformKeysService() override; |
50 | 50 |
| 51 // Disables the checks whether an extension is allowed to use the signing |
| 52 // function of a key or not. |
| 53 // TODO(pneubeck): Remove this once a GrantSignPermission(extendion_id, |
| 54 // public_key) is implemented. |
| 55 void DisablePermissionCheckForTesting(); |
| 56 |
51 // If the generation was successful, |public_key_spki_der| will contain the | 57 // If the generation was successful, |public_key_spki_der| will contain the |
52 // DER encoding of the SubjectPublicKeyInfo of the generated key and | 58 // DER encoding of the SubjectPublicKeyInfo of the generated key and |
53 // |error_message| will be empty. If it failed, |public_key_spki_der| will be | 59 // |error_message| will be empty. If it failed, |public_key_spki_der| will be |
54 // empty and |error_message| contain an error message. | 60 // empty and |error_message| contain an error message. |
55 typedef base::Callback<void(const std::string& public_key_spki_der, | 61 typedef base::Callback<void(const std::string& public_key_spki_der, |
56 const std::string& error_message)> | 62 const std::string& error_message)> |
57 GenerateKeyCallback; | 63 GenerateKeyCallback; |
58 | 64 |
59 // Generates a RSA key pair with |modulus_length_bits| and registers the key | 65 // Generates a RSA key pair with |modulus_length_bits| and registers the key |
60 // to allow a single sign operation by the given extension. |token_id| is | 66 // to allow a single sign operation by the given extension. |token_id| is |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Callback used by |GetPlatformKeysOfExtension|. | 185 // Callback used by |GetPlatformKeysOfExtension|. |
180 // Is called with |value| set to the PlatformKeys value read from the | 186 // Is called with |value| set to the PlatformKeys value read from the |
181 // StateStore, which it forwards to |callback|. On error, calls |callback| | 187 // StateStore, which it forwards to |callback|. On error, calls |callback| |
182 // with NULL; if no value existed, with an empty list. | 188 // with NULL; if no value existed, with an empty list. |
183 void GotPlatformKeysOfExtension(const std::string& extension_id, | 189 void GotPlatformKeysOfExtension(const std::string& extension_id, |
184 const GetPlatformKeysCallback& callback, | 190 const GetPlatformKeysCallback& callback, |
185 scoped_ptr<base::Value> value); | 191 scoped_ptr<base::Value> value); |
186 | 192 |
187 content::BrowserContext* browser_context_; | 193 content::BrowserContext* browser_context_; |
188 extensions::StateStore* state_store_; | 194 extensions::StateStore* state_store_; |
| 195 bool permission_check_disabled_; |
189 base::WeakPtrFactory<PlatformKeysService> weak_factory_; | 196 base::WeakPtrFactory<PlatformKeysService> weak_factory_; |
190 | 197 |
191 DISALLOW_COPY_AND_ASSIGN(PlatformKeysService); | 198 DISALLOW_COPY_AND_ASSIGN(PlatformKeysService); |
192 }; | 199 }; |
193 | 200 |
194 } // namespace chromeos | 201 } // namespace chromeos |
195 | 202 |
196 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ | 203 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ |
OLD | NEW |