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 "base/crypto/rsa_private_key.h" | 5 #include "base/crypto/rsa_private_key.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/crypto/cssm_init.h" | 9 #include "base/crypto/cssm_init.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 | 14 |
15 // static | 15 // static |
16 RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) { | 16 RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) { |
17 scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey); | 17 scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey); |
18 | 18 |
19 CSSM_CC_HANDLE cc_handle; | 19 CSSM_CC_HANDLE cc_handle; |
20 CSSM_RETURN crtn; | 20 CSSM_RETURN crtn; |
21 crtn = CSSM_CSP_CreateKeyGenContext(GetSharedCSPHandle(), CSSM_ALGID_RSA, | 21 crtn = CSSM_CSP_CreateKeyGenContext(GetSharedCSPHandle(), CSSM_ALGID_RSA, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) { | 187 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) { |
188 PrivateKeyInfoCodec private_key_info(true); | 188 PrivateKeyInfoCodec private_key_info(true); |
189 std::vector<uint8> private_key_data; | 189 std::vector<uint8> private_key_data; |
190 private_key_data.assign(key_.KeyData.Data, | 190 private_key_data.assign(key_.KeyData.Data, |
191 key_.KeyData.Data + key_.KeyData.Length); | 191 key_.KeyData.Data + key_.KeyData.Length); |
192 return (private_key_info.Import(private_key_data) && | 192 return (private_key_info.Import(private_key_data) && |
193 private_key_info.ExportPublicKeyInfo(output)); | 193 private_key_info.ExportPublicKeyInfo(output)); |
194 } | 194 } |
195 | 195 |
196 } // namespace base | 196 } // namespace base |
OLD | NEW |