OLD | NEW |
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 Loading... |
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 |
OLD | NEW |