OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RSA_PRIVATE_KEY_H_ | 5 #ifndef CRYPTO_RSA_PRIVATE_KEY_H_ |
6 #define CRYPTO_RSA_PRIVATE_KEY_H_ | 6 #define CRYPTO_RSA_PRIVATE_KEY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 #if defined(USE_OPENSSL) | 193 #if defined(USE_OPENSSL) |
194 EVP_PKEY* key() { return key_; } | 194 EVP_PKEY* key() { return key_; } |
195 #else | 195 #else |
196 SECKEYPrivateKey* key() { return key_; } | 196 SECKEYPrivateKey* key() { return key_; } |
197 SECKEYPublicKey* public_key() { return public_key_; } | 197 SECKEYPublicKey* public_key() { return public_key_; } |
198 #endif | 198 #endif |
199 | 199 |
200 // Creates a copy of the object. | 200 // Creates a copy of the object. |
201 RSAPrivateKey* Copy() const; | 201 RSAPrivateKey* Copy() const; |
202 | 202 |
203 // Exports the private key to a PKCS #1 PrivateKey block. | 203 // Exports the private key to a PKCS #8 PrivateKeyInfo block. |
204 bool ExportPrivateKey(std::vector<uint8_t>* output) const; | 204 bool ExportPrivateKey(std::vector<uint8_t>* output) const; |
205 | 205 |
206 // Exports the public key to an X509 SubjectPublicKeyInfo block. | 206 // Exports the public key to an X509 SubjectPublicKeyInfo block. |
207 bool ExportPublicKey(std::vector<uint8_t>* output) const; | 207 bool ExportPublicKey(std::vector<uint8_t>* output) const; |
208 | 208 |
209 private: | 209 private: |
210 // Constructor is private. Use one of the Create*() methods above instead. | 210 // Constructor is private. Use one of the Create*() methods above instead. |
211 RSAPrivateKey(); | 211 RSAPrivateKey(); |
212 | 212 |
213 #if defined(USE_OPENSSL) | 213 #if defined(USE_OPENSSL) |
214 EVP_PKEY* key_; | 214 EVP_PKEY* key_; |
215 #else | 215 #else |
216 SECKEYPrivateKey* key_; | 216 SECKEYPrivateKey* key_; |
217 SECKEYPublicKey* public_key_; | 217 SECKEYPublicKey* public_key_; |
218 #endif | 218 #endif |
219 | 219 |
220 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 220 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
221 }; | 221 }; |
222 | 222 |
223 } // namespace crypto | 223 } // namespace crypto |
224 | 224 |
225 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ | 225 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ |
OLD | NEW |