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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 9 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 &key)) { | 149 &key)) { |
150 result.completeWithError(); | 150 result.completeWithError(); |
151 return; | 151 return; |
152 } | 152 } |
153 DCHECK(key.handle()); | 153 DCHECK(key.handle()); |
154 DCHECK(!key.algorithm().isNull()); | 154 DCHECK(!key.algorithm().isNull()); |
155 DCHECK_EQ(extractable, key.extractable()); | 155 DCHECK_EQ(extractable, key.extractable()); |
156 result.completeWithKey(key); | 156 result.completeWithKey(key); |
157 } | 157 } |
158 | 158 |
| 159 void WebCryptoImpl::exportKey( |
| 160 blink::WebCryptoKeyFormat format, |
| 161 const blink::WebCryptoKey& key, |
| 162 blink::WebCryptoResult result) { |
| 163 blink::WebArrayBuffer buffer; |
| 164 if (!ExportKeyInternal(format, key, &buffer)) { |
| 165 result.completeWithError(); |
| 166 return; |
| 167 } |
| 168 result.completeWithBuffer(buffer); |
| 169 } |
| 170 |
159 void WebCryptoImpl::sign( | 171 void WebCryptoImpl::sign( |
160 const blink::WebCryptoAlgorithm& algorithm, | 172 const blink::WebCryptoAlgorithm& algorithm, |
161 const blink::WebCryptoKey& key, | 173 const blink::WebCryptoKey& key, |
162 const unsigned char* data, | 174 const unsigned char* data, |
163 unsigned data_size, | 175 unsigned data_size, |
164 blink::WebCryptoResult result) { | 176 blink::WebCryptoResult result) { |
165 DCHECK(!algorithm.isNull()); | 177 DCHECK(!algorithm.isNull()); |
166 blink::WebArrayBuffer buffer; | 178 blink::WebArrayBuffer buffer; |
167 if (!SignInternal(algorithm, key, data, data_size, &buffer)) { | 179 if (!SignInternal(algorithm, key, data, data_size, &buffer)) { |
168 result.completeWithError(); | 180 result.completeWithError(); |
(...skipping 19 matching lines...) Expand all Loading... |
188 data, | 200 data, |
189 data_size, | 201 data_size, |
190 &signature_match)) { | 202 &signature_match)) { |
191 result.completeWithError(); | 203 result.completeWithError(); |
192 } else { | 204 } else { |
193 result.completeWithBoolean(signature_match); | 205 result.completeWithBoolean(signature_match); |
194 } | 206 } |
195 } | 207 } |
196 | 208 |
197 } // namespace content | 209 } // namespace content |
OLD | NEW |