| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 std::vector<uint8> prime2_; | 158 std::vector<uint8> prime2_; |
| 159 std::vector<uint8> exponent1_; | 159 std::vector<uint8> exponent1_; |
| 160 std::vector<uint8> exponent2_; | 160 std::vector<uint8> exponent2_; |
| 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 class RSAPrivateKey { | 169 class RSAPrivateKey { |
| 169 public: | 170 public: |
| 170 // Create a new random instance. Can return NULL if initialization fails. | 171 // Create a new random instance. Can return NULL if initialization fails. |
| 171 static RSAPrivateKey* Create(uint16 num_bits); | 172 static RSAPrivateKey* Create(uint16 num_bits); |
| 172 | 173 |
| 173 // Create a new random instance. Can return NULL if initialization fails. | 174 // Create a new random instance. Can return NULL if initialization fails. |
| 174 // The created key is permanent and is not exportable in plaintext form. | 175 // The created key is permanent and is not exportable in plaintext form. |
| 175 // | 176 // |
| 176 // NOTE: Currently only available if USE_NSS is defined. | 177 // NOTE: Currently only available if USE_NSS is defined. |
| 177 static RSAPrivateKey* CreateSensitive(uint16 num_bits); | 178 static RSAPrivateKey* CreateSensitive(uint16 num_bits); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 #elif defined(OS_MACOSX) | 258 #elif defined(OS_MACOSX) |
| 258 CSSM_KEY key_; | 259 CSSM_KEY key_; |
| 259 #endif | 260 #endif |
| 260 | 261 |
| 261 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 262 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 } // namespace base | 265 } // namespace base |
| 265 | 266 |
| 266 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ | 267 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ |
| OLD | NEW |