| OLD | NEW |
| 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/webcrypto_impl.h" | 5 #include "content/renderer/webcrypto/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 Loading... |
| 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)) { |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 data, | 115 data, |
| 102 data_size, | 116 data_size, |
| 103 &signature_match)) { | 117 &signature_match)) { |
| 104 result.completeWithError(); | 118 result.completeWithError(); |
| 105 } else { | 119 } else { |
| 106 result.completeWithBoolean(signature_match); | 120 result.completeWithBoolean(signature_match); |
| 107 } | 121 } |
| 108 } | 122 } |
| 109 | 123 |
| 110 } // namespace content | 124 } // namespace content |
| OLD | NEW |