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

Side by Side Diff: content/renderer/webcrypto_impl.cc

Issue 24656002: [webcrypto] Add decrypt() for AES-CBC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer/webcrypto_impl.h" 5 #include "content/renderer/webcrypto_impl.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" 8 #include "third_party/WebKit/public/platform/WebArrayBuffer.h"
9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
10 #include "third_party/WebKit/public/platform/WebCryptoKey.h" 10 #include "third_party/WebKit/public/platform/WebCryptoKey.h"
(...skipping 11 matching lines...) Expand all
22 unsigned data_size, 22 unsigned data_size,
23 WebKit::WebCryptoResult result) { 23 WebKit::WebCryptoResult result) {
24 WebKit::WebArrayBuffer buffer; 24 WebKit::WebArrayBuffer buffer;
25 if (!EncryptInternal(algorithm, key, data, data_size, &buffer)) { 25 if (!EncryptInternal(algorithm, key, data, data_size, &buffer)) {
26 result.completeWithError(); 26 result.completeWithError();
27 } else { 27 } else {
28 result.completeWithBuffer(buffer); 28 result.completeWithBuffer(buffer);
29 } 29 }
30 } 30 }
31 31
32 void WebCryptoImpl::decrypt(
33 const WebKit::WebCryptoAlgorithm& algorithm,
34 const WebKit::WebCryptoKey& key,
35 const unsigned char* data,
36 unsigned data_size,
37 WebKit::WebCryptoResult result) {
38 WebKit::WebArrayBuffer buffer;
39 if (!DecryptInternal(algorithm, key, data, data_size, &buffer)) {
jamesr 2013/09/25 21:29:05 no {}s for one-line bodies, right?
eroman 2013/09/25 22:11:59 I am matching the style elsewhere in this file. A
40 result.completeWithError();
41 } else {
42 result.completeWithBuffer(buffer);
43 }
44 }
45
32 void WebCryptoImpl::digest( 46 void WebCryptoImpl::digest(
33 const WebKit::WebCryptoAlgorithm& algorithm, 47 const WebKit::WebCryptoAlgorithm& algorithm,
34 const unsigned char* data, 48 const unsigned char* data,
35 unsigned data_size, 49 unsigned data_size,
36 WebKit::WebCryptoResult result) { 50 WebKit::WebCryptoResult result) {
37 WebKit::WebArrayBuffer buffer; 51 WebKit::WebArrayBuffer buffer;
38 if (!DigestInternal(algorithm, data, data_size, &buffer)) { 52 if (!DigestInternal(algorithm, data, data_size, &buffer)) {
39 result.completeWithError(); 53 result.completeWithError();
40 } else { 54 } else {
41 result.completeWithBuffer(buffer); 55 result.completeWithBuffer(buffer);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 WebKit::WebCryptoResult result) { 93 WebKit::WebCryptoResult result) {
80 WebKit::WebArrayBuffer buffer; 94 WebKit::WebArrayBuffer buffer;
81 if (!SignInternal(algorithm, key, data, data_size, &buffer)) { 95 if (!SignInternal(algorithm, key, data, data_size, &buffer)) {
82 result.completeWithError(); 96 result.completeWithError();
83 } else { 97 } else {
84 result.completeWithBuffer(buffer); 98 result.completeWithBuffer(buffer);
85 } 99 }
86 } 100 }
87 101
88 } // namespace content 102 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698