OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CRYPTO_EC_PRIVATE_KEY_H_ | 5 #ifndef CRYPTO_EC_PRIVATE_KEY_H_ |
6 #define CRYPTO_EC_PRIVATE_KEY_H_ | 6 #define CRYPTO_EC_PRIVATE_KEY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // Encapsulates an elliptic curve (EC) private key. Can be used to generate new | 28 // Encapsulates an elliptic curve (EC) private key. Can be used to generate new |
29 // keys, export keys to other formats, or to extract a public key. | 29 // keys, export keys to other formats, or to extract a public key. |
30 // TODO(mattm): make this and RSAPrivateKey implement some PrivateKey interface. | 30 // TODO(mattm): make this and RSAPrivateKey implement some PrivateKey interface. |
31 // (The difference in types of key() and public_key() make this a little | 31 // (The difference in types of key() and public_key() make this a little |
32 // tricky.) | 32 // tricky.) |
33 class CRYPTO_EXPORT ECPrivateKey { | 33 class CRYPTO_EXPORT ECPrivateKey { |
34 public: | 34 public: |
35 ~ECPrivateKey(); | 35 ~ECPrivateKey(); |
36 | 36 |
| 37 // Returns whether the system supports elliptic curve cryptography. |
| 38 static bool IsSupported(); |
| 39 |
37 // Creates a new random instance. Can return NULL if initialization fails. | 40 // Creates a new random instance. Can return NULL if initialization fails. |
38 // The created key will use the NIST P-256 curve. | 41 // The created key will use the NIST P-256 curve. |
39 // TODO(mattm): Add a curve parameter. | 42 // TODO(mattm): Add a curve parameter. |
40 static ECPrivateKey* Create(); | 43 static ECPrivateKey* Create(); |
41 | 44 |
42 // Creates a new random instance. Can return NULL if initialization fails. | 45 // Creates a new random instance. Can return NULL if initialization fails. |
43 // The created key is permanent and is not exportable in plaintext form. | 46 // The created key is permanent and is not exportable in plaintext form. |
44 // | 47 // |
45 // NOTE: Currently only available if USE_NSS is defined. | 48 // NOTE: Currently only available if USE_NSS is defined. |
46 static ECPrivateKey* CreateSensitive(); | 49 static ECPrivateKey* CreateSensitive(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 SECKEYPublicKey* public_key_; | 135 SECKEYPublicKey* public_key_; |
133 #endif | 136 #endif |
134 | 137 |
135 DISALLOW_COPY_AND_ASSIGN(ECPrivateKey); | 138 DISALLOW_COPY_AND_ASSIGN(ECPrivateKey); |
136 }; | 139 }; |
137 | 140 |
138 | 141 |
139 } // namespace crypto | 142 } // namespace crypto |
140 | 143 |
141 #endif // CRYPTO_EC_PRIVATE_KEY_H_ | 144 #endif // CRYPTO_EC_PRIVATE_KEY_H_ |
OLD | NEW |