| 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_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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 unsigned data_size, | 64 unsigned data_size, |
| 65 WebKit::WebCryptoResult result) { | 65 WebKit::WebCryptoResult result) { |
| 66 WebKit::WebArrayBuffer buffer; | 66 WebKit::WebArrayBuffer buffer; |
| 67 if (!SignInternal(algorithm, key, data, data_size, &buffer)) { | 67 if (!SignInternal(algorithm, key, data, data_size, &buffer)) { |
| 68 result.completeWithError(); | 68 result.completeWithError(); |
| 69 } else { | 69 } else { |
| 70 result.completeWithBuffer(buffer); | 70 result.completeWithBuffer(buffer); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 void WebCryptoImpl::verifySignature( |
| 75 const WebKit::WebCryptoAlgorithm& algorithm, |
| 76 const WebKit::WebCryptoKey& key, |
| 77 const unsigned char* signature, |
| 78 unsigned signature_size, |
| 79 const unsigned char* data, |
| 80 unsigned data_size, |
| 81 WebKit::WebCryptoResult result) { |
| 82 bool signature_match = false; |
| 83 if (!VerifySignatureInternal(algorithm, |
| 84 key, |
| 85 signature, |
| 86 signature_size, |
| 87 data, |
| 88 data_size, |
| 89 &signature_match)) { |
| 90 result.completeWithError(); |
| 91 } else { |
| 92 result.completeWithBoolean(signature_match); |
| 93 } |
| 94 } |
| 95 |
| 74 } // namespace content | 96 } // namespace content |
| OLD | NEW |