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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 const GenerateKeyCallback& callback, | 40 const GenerateKeyCallback& callback, |
41 Profile* profile); | 41 Profile* profile); |
42 | 42 |
43 // If signing was successful, |signature| will be contain the signature and | 43 // If signing was successful, |signature| will be contain the signature and |
44 // |error_message| will be empty. If it failed, |signature| will be empty and | 44 // |error_message| will be empty. If it failed, |signature| will be empty and |
45 // |error_message| contain an error message. | 45 // |error_message| contain an error message. |
46 typedef base::Callback<void(const std::string& signature, | 46 typedef base::Callback<void(const std::string& signature, |
47 const std::string& error_message)> SignCallback; | 47 const std::string& error_message)> SignCallback; |
48 | 48 |
49 // Signs |data| with the private key matching |public_key|, if that key is | 49 // Signs |data| with the private key matching |public_key|, if that key is |
50 // stored in the given token. |token_id| is currently ignored, instead the user | 50 // stored in the given token. Uses |hash_algorithm_name| to digest |data|, which |
51 // token associated with |profile| is always used. |public_key| must be the DER | 51 // must be one of SHA-{1,256,384,512}. |token_id| is currently ignored, instead |
52 // encoding of a SubjectPublicKeyInfo. |callback| will be invoked with the | 52 // the user token associated with |profile| is always used. |public_key| must be |
53 // signature or an error message. | 53 // the DER encoding of a SubjectPublicKeyInfo. |callback| will be invoked with |
| 54 // the signature or an error message. |
54 // Currently supports RSA keys only. | 55 // Currently supports RSA keys only. |
55 void Sign(const std::string& token_id, | 56 void Sign(const std::string& token_id, |
56 const std::string& public_key, | 57 const std::string& public_key, |
| 58 const std::string& hash_algorithm_name, |
57 const std::string& data, | 59 const std::string& data, |
58 const SignCallback& callback, | 60 const SignCallback& callback, |
59 Profile* profile); | 61 Profile* profile); |
60 | 62 |
61 // If the list of certificates could be successfully retrieved, |certs| will | 63 // If the list of certificates could be successfully retrieved, |certs| will |
62 // contain the list of available certificates (maybe empty) and |error_message| | 64 // contain the list of available certificates (maybe empty) and |error_message| |
63 // will be empty. If an error occurred, |certs| will be empty and | 65 // will be empty. If an error occurred, |certs| will be empty and |
64 // |error_message| contain an error message. | 66 // |error_message| contain an error message. |
65 typedef base::Callback<void(scoped_ptr<net::CertificateList> certs, | 67 typedef base::Callback<void(scoped_ptr<net::CertificateList> certs, |
66 const std::string& error_message)> | 68 const std::string& error_message)> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void RemoveCertificate(const std::string& token_id, | 103 void RemoveCertificate(const std::string& token_id, |
102 scoped_refptr<net::X509Certificate> certificate, | 104 scoped_refptr<net::X509Certificate> certificate, |
103 const RemoveCertificateCallback& callback, | 105 const RemoveCertificateCallback& callback, |
104 Profile* profile); | 106 Profile* profile); |
105 | 107 |
106 } // namespace platform_keys | 108 } // namespace platform_keys |
107 | 109 |
108 } // namespace chromeos | 110 } // namespace chromeos |
109 | 111 |
110 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | 112 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ |
OLD | NEW |