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

Side by Side Diff: base/crypto/rsa_private_key.h

Issue 6081007: Start sorting methods in class declarations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 9 years, 11 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 | « base/command_line.h ('k') | base/crypto/signature_creator.h » ('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) 2009 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 BASE_CRYPTO_RSA_PRIVATE_KEY_H_ 5 #ifndef BASE_CRYPTO_RSA_PRIVATE_KEY_H_
6 #define BASE_CRYPTO_RSA_PRIVATE_KEY_H_ 6 #define BASE_CRYPTO_RSA_PRIVATE_KEY_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
11 #if defined(USE_OPENSSL) 11 #if defined(USE_OPENSSL)
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 std::vector<uint8> coefficient_; 161 std::vector<uint8> coefficient_;
162 162
163 DISALLOW_COPY_AND_ASSIGN(PrivateKeyInfoCodec); 163 DISALLOW_COPY_AND_ASSIGN(PrivateKeyInfoCodec);
164 }; 164 };
165 165
166 // Encapsulates an RSA private key. Can be used to generate new keys, export 166 // Encapsulates an RSA private key. Can be used to generate new keys, export
167 // keys to other formats, or to extract a public key. 167 // keys to other formats, or to extract a public key.
168 // TODO(hclam): This class should be ref-counted so it can be reused easily. 168 // TODO(hclam): This class should be ref-counted so it can be reused easily.
169 class RSAPrivateKey { 169 class RSAPrivateKey {
170 public: 170 public:
171 ~RSAPrivateKey();
172
171 // Create a new random instance. Can return NULL if initialization fails. 173 // Create a new random instance. Can return NULL if initialization fails.
172 static RSAPrivateKey* Create(uint16 num_bits); 174 static RSAPrivateKey* Create(uint16 num_bits);
173 175
174 // Create a new random instance. Can return NULL if initialization fails. 176 // Create a new random instance. Can return NULL if initialization fails.
175 // The created key is permanent and is not exportable in plaintext form. 177 // The created key is permanent and is not exportable in plaintext form.
176 // 178 //
177 // NOTE: Currently only available if USE_NSS is defined. 179 // NOTE: Currently only available if USE_NSS is defined.
178 static RSAPrivateKey* CreateSensitive(uint16 num_bits); 180 static RSAPrivateKey* CreateSensitive(uint16 num_bits);
179 181
180 // Create a new instance by importing an existing private key. The format is 182 // Create a new instance by importing an existing private key. The format is
(...skipping 15 matching lines...) Expand all
196 // half in the key database. The format of the public key blob is is 198 // half in the key database. The format of the public key blob is is
197 // an X509 SubjectPublicKeyInfo block. This can return NULL if 199 // an X509 SubjectPublicKeyInfo block. This can return NULL if
198 // initialization fails or the private key cannot be found. The 200 // initialization fails or the private key cannot be found. The
199 // caller takes ownership of the returned object, but nothing new is 201 // caller takes ownership of the returned object, but nothing new is
200 // created in the key database. 202 // created in the key database.
201 // 203 //
202 // NOTE: Currently only available if USE_NSS is defined. 204 // NOTE: Currently only available if USE_NSS is defined.
203 static RSAPrivateKey* FindFromPublicKeyInfo( 205 static RSAPrivateKey* FindFromPublicKeyInfo(
204 const std::vector<uint8>& input); 206 const std::vector<uint8>& input);
205 207
206 ~RSAPrivateKey();
207
208 #if defined(USE_OPENSSL) 208 #if defined(USE_OPENSSL)
209 EVP_PKEY* key() { return key_; } 209 EVP_PKEY* key() { return key_; }
210 #elif defined(USE_NSS) 210 #elif defined(USE_NSS)
211 SECKEYPrivateKeyStr* key() { return key_; } 211 SECKEYPrivateKeyStr* key() { return key_; }
212 SECKEYPublicKeyStr* public_key() { return public_key_; } 212 SECKEYPublicKeyStr* public_key() { return public_key_; }
213 #elif defined(OS_WIN) 213 #elif defined(OS_WIN)
214 HCRYPTPROV provider() { return provider_; } 214 HCRYPTPROV provider() { return provider_; }
215 HCRYPTKEY key() { return key_; } 215 HCRYPTKEY key() { return key_; }
216 #elif defined(OS_MACOSX) 216 #elif defined(OS_MACOSX)
217 CSSM_KEY_PTR key() { return &key_; } 217 CSSM_KEY_PTR key() { return &key_; }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 #elif defined(OS_MACOSX) 258 #elif defined(OS_MACOSX)
259 CSSM_KEY key_; 259 CSSM_KEY key_;
260 #endif 260 #endif
261 261
262 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); 262 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey);
263 }; 263 };
264 264
265 } // namespace base 265 } // namespace base
266 266
267 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ 267 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_
OLDNEW
« no previous file with comments | « base/command_line.h ('k') | base/crypto/signature_creator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698