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

Side by Side Diff: crypto/symmetric_key_mac.cc

Issue 8949056: This adds support for encrypted ONC import (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handling decryption errors better Created 8 years, 11 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 "crypto/symmetric_key.h" 5 #include "crypto/symmetric_key.h"
6 6
7 #include <CommonCrypto/CommonCryptor.h> 7 #include <CommonCrypto/CommonCryptor.h>
8 #include <CoreFoundation/CFString.h> 8 #include <CoreFoundation/CFString.h>
9 #include <Security/cssm.h> 9 #include <Security/cssm.h>
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // static 140 // static
141 SymmetricKey* SymmetricKey::Import(Algorithm algorithm, 141 SymmetricKey* SymmetricKey::Import(Algorithm algorithm,
142 const std::string& raw_key) { 142 const std::string& raw_key) {
143 return new SymmetricKey(raw_key.data(), raw_key.size() * 8); 143 return new SymmetricKey(raw_key.data(), raw_key.size() * 8);
144 } 144 }
145 145
146 SymmetricKey::SymmetricKey(const void* key_data, size_t key_size_in_bits) 146 SymmetricKey::SymmetricKey(const void* key_data, size_t key_size_in_bits)
147 : key_(reinterpret_cast<const char*>(key_data), key_size_in_bits / 8) { 147 : key_(reinterpret_cast<const char*>(key_data), key_size_in_bits / 8) {
148 } 148 }
149 149
150 bool SymmetricKey::GetRawKey(std::string* raw_key) { 150 bool SymmetricKey::GetRawKey(std::string* raw_key) const {
151 *raw_key = key_; 151 *raw_key = key_;
152 return true; 152 return true;
153 } 153 }
154 154
155 CSSM_DATA SymmetricKey::cssm_data() const { 155 CSSM_DATA SymmetricKey::cssm_data() const {
156 return StringToData(key_); 156 return StringToData(key_);
157 } 157 }
158 158
159 } // namespace crypto 159 } // namespace crypto
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698