Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: crypto/ec_private_key.h

Issue 10700099: NSS Channel ID: don't check ECC support on every socket creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move the magic into ECPrivateKey Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | crypto/ec_private_key_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "crypto/crypto_export.h" 14 #include "crypto/crypto_export.h"
15 15
16 #if defined(USE_OPENSSL) 16 #if defined(USE_OPENSSL)
17 // Forward declaration for openssl/*.h 17 // Forward declaration for openssl/*.h
18 typedef struct evp_pkey_st EVP_PKEY; 18 typedef struct evp_pkey_st EVP_PKEY;
19 #else 19 #else
20 // Forward declaration. 20 // Forward declaration.
21 typedef struct CERTSubjectPublicKeyInfoStr CERTSubjectPublicKeyInfo; 21 typedef struct CERTSubjectPublicKeyInfoStr CERTSubjectPublicKeyInfo;
22 typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey; 22 typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey;
23 typedef struct SECKEYPublicKeyStr SECKEYPublicKey; 23 typedef struct SECKEYPublicKeyStr SECKEYPublicKey;
24 typedef struct PK11SlotInfoStr PK11SlotInfo;
24 #endif 25 #endif
Ryan Sleevi 2012/07/04 03:00:04 Still needed?
25 26
26 namespace crypto { 27 namespace crypto {
27 28
28 // Encapsulates an elliptic curve (EC) private key. Can be used to generate new 29 // 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. 30 // keys, export keys to other formats, or to extract a public key.
30 // TODO(mattm): make this and RSAPrivateKey implement some PrivateKey interface. 31 // TODO(mattm): make this and RSAPrivateKey implement some PrivateKey interface.
31 // (The difference in types of key() and public_key() make this a little 32 // (The difference in types of key() and public_key() make this a little
32 // tricky.) 33 // tricky.)
33 class CRYPTO_EXPORT ECPrivateKey { 34 class CRYPTO_EXPORT ECPrivateKey {
34 public: 35 public:
35 ~ECPrivateKey(); 36 ~ECPrivateKey();
36 37
38 // Returns whether the system supports elliptic curve cryptography.
39 static bool IsSupported();
40
37 // Creates a new random instance. Can return NULL if initialization fails. 41 // Creates a new random instance. Can return NULL if initialization fails.
38 // The created key will use the NIST P-256 curve. 42 // The created key will use the NIST P-256 curve.
39 // TODO(mattm): Add a curve parameter. 43 // TODO(mattm): Add a curve parameter.
40 static ECPrivateKey* Create(); 44 static ECPrivateKey* Create();
41 45
42 // Creates a new random instance. Can return NULL if initialization fails. 46 // Creates a new random instance. Can return NULL if initialization fails.
43 // The created key is permanent and is not exportable in plaintext form. 47 // The created key is permanent and is not exportable in plaintext form.
44 // 48 //
45 // NOTE: Currently only available if USE_NSS is defined. 49 // NOTE: Currently only available if USE_NSS is defined.
46 static ECPrivateKey* CreateSensitive(); 50 static ECPrivateKey* CreateSensitive();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 SECKEYPublicKey* public_key_; 136 SECKEYPublicKey* public_key_;
133 #endif 137 #endif
134 138
135 DISALLOW_COPY_AND_ASSIGN(ECPrivateKey); 139 DISALLOW_COPY_AND_ASSIGN(ECPrivateKey);
136 }; 140 };
137 141
138 142
139 } // namespace crypto 143 } // namespace crypto
140 144
141 #endif // CRYPTO_EC_PRIVATE_KEY_H_ 145 #endif // CRYPTO_EC_PRIVATE_KEY_H_
OLDNEW
« no previous file with comments | « no previous file | crypto/ec_private_key_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698