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 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Security.fram
ework/Headers/cssmapi.h> |
| 6 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Security.fram
ework/Headers/cssmtype.h> |
| 7 #include <stdbool.h> |
| 8 #include <string.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/crypto/cssm_init.h" |
5 #include "base/crypto/rsa_private_key.h" | 13 #include "base/crypto/rsa_private_key.h" |
6 | |
7 #include <list> | |
8 | |
9 #include "base/crypto/cssm_init.h" | |
10 #include "base/logging.h" | 14 #include "base/logging.h" |
11 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
12 | 16 |
13 namespace base { | 17 namespace base { |
14 | 18 |
15 // static | 19 // static |
16 RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) { | 20 RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) { |
17 scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey); | 21 scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey); |
18 | 22 |
19 CSSM_CC_HANDLE cc_handle; | 23 CSSM_CC_HANDLE cc_handle; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) { | 152 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) { |
149 PrivateKeyInfoCodec private_key_info(true); | 153 PrivateKeyInfoCodec private_key_info(true); |
150 std::vector<uint8> private_key_data; | 154 std::vector<uint8> private_key_data; |
151 private_key_data.assign(key_.KeyData.Data, | 155 private_key_data.assign(key_.KeyData.Data, |
152 key_.KeyData.Data + key_.KeyData.Length); | 156 key_.KeyData.Data + key_.KeyData.Length); |
153 return (private_key_info.Import(private_key_data) && | 157 return (private_key_info.Import(private_key_data) && |
154 private_key_info.ExportPublicKeyInfo(output)); | 158 private_key_info.ExportPublicKeyInfo(output)); |
155 } | 159 } |
156 | 160 |
157 } // namespace base | 161 } // namespace base |
OLD | NEW |