OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback_forward.h" | |
12 #include "base/macros.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "base/memory/scoped_ptr.h" | |
15 | |
16 class Profile; | |
17 | |
18 namespace net { | |
19 class X509Certificate; | |
20 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | |
21 } | |
22 | |
23 namespace chromeos { | |
24 | |
25 namespace platform_keys { | |
26 | |
27 typedef base::Callback< | |
28 void(const std::string& public_key_str, const std::string& error_message)> | |
29 GenerateKeyCallback; | |
30 | |
31 // Generates a RSA key with |modulus_length|. |token_id| is currently ignored, | |
32 // instead always the user token associated to |profile| is used. |callback| | |
33 // will be called back with the DER enoding of the SubjectPublicKeyInfo of the | |
34 // generated key or an error message. | |
not at google - send to devlin
2014/05/14 18:11:01
maybe put the description of the arguments on the
pneubeck (no reviews)
2014/05/15 09:25:10
Done.
| |
35 void GenerateRSAKey(const std::string& token_id, | |
36 int modulus_length, | |
37 const GenerateKeyCallback& callback, | |
38 Profile* profile); | |
39 | |
40 typedef base::Callback<void(const std::string& signature, | |
41 const std::string& error_message)> SignCallback; | |
42 | |
43 // Signs |data| with the private key matching |public_key|, if that key is | |
44 // stored in the given token. |token_id| is currently ignored, instead always | |
45 // the user token associated to |profile| is used. |public_key| must be the DER | |
46 // encoding of a SubjectPublicKeyInfo. |callback| will be called back with the | |
47 // signature or an error message. | |
48 // Currently supports RSA keys only. | |
49 void Sign(const std::string& token_id, | |
50 const std::string& public_key, | |
51 const std::string& data, | |
52 const SignCallback& callback, | |
53 Profile* profile); | |
54 | |
55 typedef base::Callback<void(scoped_ptr<net::CertificateList> certs, | |
56 const std::string& error_message)> | |
57 GetCertificatesCallback; | |
58 | |
59 // Returns the list of all certificates with stored private key available from | |
60 // the given token. |token_id| is currently ignored, instead always the user | |
61 // token associated to |profile| is used. |callback| will be called back with | |
62 // the list of the available certificates in DER encoding or an error message. | |
63 void GetCertificates(const std::string& token_id, | |
64 const GetCertificatesCallback& callback, | |
65 Profile* profile); | |
66 | |
67 typedef base::Callback<void(const std::string& error_message)> | |
68 ImportCertificateCallback; | |
69 | |
70 // Imports |certificate| to the given token if the certified key is already | |
71 // stored in this token. |token_id| is currently ignored, instead always the | |
72 // user token associated to |profile| is used.|callback| will be called back | |
73 // when the import is finished, possibly with an error message. | |
74 void ImportCertificate(const std::string& token_id, | |
75 scoped_refptr<net::X509Certificate> certificate, | |
76 const ImportCertificateCallback& callback, | |
77 Profile* profile); | |
78 | |
79 typedef base::Callback<void(const std::string& error_message)> | |
80 RemoveCertificateCallback; | |
81 | |
82 // Removes |certificate| from the given token if present. |token_id| is | |
83 // currently ignored, instead always the user token associated to |profile| is | |
84 // used. |callback| will be called back when the removal is finished, possibly | |
85 // with an error message. | |
86 void RemoveCertificate(const std::string& token_id, | |
87 scoped_refptr<net::X509Certificate> certificate, | |
88 const RemoveCertificateCallback& callback, | |
89 Profile* profile); | |
90 | |
91 } // namespace platform_keys | |
92 | |
93 } // namespace chromeos | |
94 | |
95 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | |
OLD | NEW |