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

Side by Side Diff: content/child/webcrypto/webcrypto_impl.cc

Issue 196513002: [webcrypto] Implement structured clone of keys (chromium-side). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and add header for WebVector Created 6 years, 9 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
« no previous file with comments | « content/child/webcrypto/webcrypto_impl.h ('k') | content/child/webcrypto/webcrypto_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/webcrypto/webcrypto_impl.h" 5 #include "content/child/webcrypto/webcrypto_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/child/webcrypto/crypto_data.h" 8 #include "content/child/webcrypto/crypto_data.h"
9 #include "content/child/webcrypto/shared_crypto.h" 9 #include "content/child/webcrypto/shared_crypto.h"
10 #include "content/child/webcrypto/webcrypto_util.h" 10 #include "content/child/webcrypto/webcrypto_util.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const unsigned char* data, 200 const unsigned char* data,
201 unsigned int data_size, 201 unsigned int data_size,
202 blink::WebArrayBuffer& result) { 202 blink::WebArrayBuffer& result) {
203 blink::WebCryptoAlgorithm algorithm = 203 blink::WebCryptoAlgorithm algorithm =
204 blink::WebCryptoAlgorithm::adoptParamsAndCreate(algorithm_id, NULL); 204 blink::WebCryptoAlgorithm::adoptParamsAndCreate(algorithm_id, NULL);
205 return (webcrypto::Digest( 205 return (webcrypto::Digest(
206 algorithm, webcrypto::CryptoData(data, data_size), &result)) 206 algorithm, webcrypto::CryptoData(data, data_size), &result))
207 .IsSuccess(); 207 .IsSuccess();
208 } 208 }
209 209
210 bool WebCryptoImpl::deserializeKeyForClone(
211 const blink::WebCryptoKeyAlgorithm& algorithm,
212 blink::WebCryptoKeyType type,
213 bool extractable,
214 blink::WebCryptoKeyUsageMask usages,
215 const unsigned char* key_data,
216 unsigned key_data_size,
217 blink::WebCryptoKey& key) {
218 Status status = webcrypto::DeserializeKeyForClone(
219 algorithm,
220 type,
221 extractable,
222 usages,
223 webcrypto::CryptoData(key_data, key_data_size),
224 &key);
225 return status.IsSuccess();
226 }
227
228 bool WebCryptoImpl::serializeKeyForClone(
229 const blink::WebCryptoKey& key,
230 blink::WebVector<unsigned char>& key_data) {
231 Status status = webcrypto::SerializeKeyForClone(key, &key_data);
232 return status.IsSuccess();
233 }
234
210 } // namespace content 235 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/webcrypto_impl.h ('k') | content/child/webcrypto/webcrypto_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698