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

Side by Side Diff: crypto/rsa_private_key_openssl.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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
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 #include "base/crypto/rsa_private_key.h" 5 #include "base/crypto/rsa_private_key.h"
6 6
7 #include <openssl/evp.h> 7 #include <openssl/evp.h>
8 #include <openssl/pkcs12.h> 8 #include <openssl/pkcs12.h>
9 #include <openssl/rsa.h> 9 #include <openssl/rsa.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/openssl_util.h" 13 #include "base/openssl_util.h"
14 #include "base/stl_util-inl.h" 14 #include "base/stl_util-inl.h"
15 15
16 namespace base { 16 namespace crypto {
17 17
18 namespace { 18 namespace {
19 19
20 // Function pointer definition, for injecting the required key export function 20 // Function pointer definition, for injecting the required key export function
21 // into ExportKey, below. The supplied function should export EVP_PKEY into 21 // into ExportKey, below. The supplied function should export EVP_PKEY into
22 // the supplied BIO, returning 1 on success or 0 on failure. 22 // the supplied BIO, returning 1 on success or 0 on failure.
23 typedef int (ExportFunction)(BIO*, EVP_PKEY*); 23 typedef int (ExportFunction)(BIO*, EVP_PKEY*);
24 24
25 // Helper to export |key| into |output| via the specified ExportFunction. 25 // Helper to export |key| into |output| via the specified ExportFunction.
26 bool ExportKey(EVP_PKEY* key, 26 bool ExportKey(EVP_PKEY* key,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 126
127 bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) { 127 bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) {
128 return ExportKey(key_, i2d_PKCS8PrivateKeyInfo_bio, output); 128 return ExportKey(key_, i2d_PKCS8PrivateKeyInfo_bio, output);
129 } 129 }
130 130
131 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) { 131 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) {
132 return ExportKey(key_, i2d_PUBKEY_bio, output); 132 return ExportKey(key_, i2d_PUBKEY_bio, output);
133 } 133 }
134 134
135 } // namespace base 135 } // namespace crypto
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698