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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class BrowserContext; | 17 class BrowserContext; |
18 } | 18 } |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 class X509Certificate; | 21 class X509Certificate; |
22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
23 } | 23 } |
24 | 24 |
25 namespace chromeos { | 25 namespace chromeos { |
26 | 26 |
27 namespace platform_keys { | 27 namespace platform_keys { |
28 | 28 |
| 29 // A token is a store for keys or certs and can provide cryptographic |
| 30 // operations. |
| 31 // ChromeOS provides itself a user token and conditionally a system wide token, |
| 32 // thus these tokens use static identifiers. The platform keys API is designed |
| 33 // to support arbitrary other tokens in the future, which could then use |
| 34 // run-time generated IDs. |
| 35 extern const char kTokenIdUser[]; |
| 36 extern const char kTokenIdSystem[]; |
| 37 |
29 // Supported hash algorithms. | 38 // Supported hash algorithms. |
30 enum HashAlgorithm { | 39 enum HashAlgorithm { |
31 HASH_ALGORITHM_SHA1, | 40 HASH_ALGORITHM_SHA1, |
32 HASH_ALGORITHM_SHA256, | 41 HASH_ALGORITHM_SHA256, |
33 HASH_ALGORITHM_SHA384, | 42 HASH_ALGORITHM_SHA384, |
34 HASH_ALGORITHM_SHA512 | 43 HASH_ALGORITHM_SHA512 |
35 }; | 44 }; |
36 | 45 |
37 namespace subtle { | 46 namespace subtle { |
38 // Functions of this namespace shouldn't be called directly from the context of | 47 // Functions of this namespace shouldn't be called directly from the context of |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 117 |
109 // Removes |certificate| from the given token if present. Any intermediate of | 118 // Removes |certificate| from the given token if present. Any intermediate of |
110 // |certificate| will be ignored. |token_id| is currently ignored, instead the | 119 // |certificate| will be ignored. |token_id| is currently ignored, instead the |
111 // user token associated with |browser_context| is always used. |callback| will | 120 // user token associated with |browser_context| is always used. |callback| will |
112 // be invoked when the removal is finished, possibly with an error message. | 121 // be invoked when the removal is finished, possibly with an error message. |
113 void RemoveCertificate(const std::string& token_id, | 122 void RemoveCertificate(const std::string& token_id, |
114 scoped_refptr<net::X509Certificate> certificate, | 123 scoped_refptr<net::X509Certificate> certificate, |
115 const RemoveCertificateCallback& callback, | 124 const RemoveCertificateCallback& callback, |
116 content::BrowserContext* browser_context); | 125 content::BrowserContext* browser_context); |
117 | 126 |
| 127 // If the list of available tokens could be successfully retrieved, |token_ids| |
| 128 // will contain the token ids. If an error occurs, |token_ids| will be NULL and |
| 129 // |error_message| will be set to an error message. |
| 130 typedef base::Callback<void(scoped_ptr<std::vector<std::string> > token_ids, |
| 131 const std::string& error_message)> |
| 132 GetTokensCallback; |
| 133 |
| 134 // Gets the list of available tokens. |callback| will be invoked when the list |
| 135 // of available tokens is determined, possibly with an error message. |
| 136 // Must be called and calls |callback| on the UI thread. |
| 137 void GetTokens(const GetTokensCallback& callback, |
| 138 content::BrowserContext* browser_context); |
| 139 |
118 } // namespace platform_keys | 140 } // namespace platform_keys |
119 | 141 |
120 } // namespace chromeos | 142 } // namespace chromeos |
121 | 143 |
122 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | 144 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ |
OLD | NEW |