| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/symmetric_key.h" | 5 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Security.fram
ework/Headers/cssmapi.h> |
| 6 | 6 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Security.fram
ework/Headers/cssmapple.h> |
| 7 #include <CommonCrypto/CommonCryptor.h> | 7 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Security.fram
ework/Headers/cssmtype.h> |
| 8 #include <CoreFoundation/CFString.h> | 8 #include <stdbool.h> |
| 9 #include <Security/cssm.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> |
| 11 #include <stdlib.h> |
| 12 #include <string> |
| 10 | 13 |
| 11 #include "base/crypto/cssm_init.h" | 14 #include "base/crypto/cssm_init.h" |
| 15 #include "base/crypto/symmetric_key.h" |
| 12 #include "base/logging.h" | 16 #include "base/logging.h" |
| 13 | 17 |
| 14 namespace { | 18 namespace { |
| 15 | 19 |
| 16 CSSM_KEY_TYPE CheckKeyParams(base::SymmetricKey::Algorithm algorithm, | 20 CSSM_KEY_TYPE CheckKeyParams(base::SymmetricKey::Algorithm algorithm, |
| 17 size_t key_size_in_bits) { | 21 size_t key_size_in_bits) { |
| 18 if (algorithm == base::SymmetricKey::AES) { | 22 if (algorithm == base::SymmetricKey::AES) { |
| 19 CHECK(key_size_in_bits == 128 || | 23 CHECK(key_size_in_bits == 128 || |
| 20 key_size_in_bits == 192 || | 24 key_size_in_bits == 192 || |
| 21 key_size_in_bits == 256) | 25 key_size_in_bits == 256) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 bool SymmetricKey::GetRawKey(std::string* raw_key) { | 150 bool SymmetricKey::GetRawKey(std::string* raw_key) { |
| 147 *raw_key = key_; | 151 *raw_key = key_; |
| 148 return true; | 152 return true; |
| 149 } | 153 } |
| 150 | 154 |
| 151 CSSM_DATA SymmetricKey::cssm_data() const { | 155 CSSM_DATA SymmetricKey::cssm_data() const { |
| 152 return StringToData(key_); | 156 return StringToData(key_); |
| 153 } | 157 } |
| 154 | 158 |
| 155 } // namespace base | 159 } // namespace base |
| OLD | NEW |