| 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/shared_crypto.h" | 5 #include "content/child/webcrypto/shared_crypto.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 dict->SetString("use", "enc"); | 312 dict->SetString("use", "enc"); |
| 313 dict->SetBoolean("ext", false); | 313 dict->SetBoolean("ext", false); |
| 314 dict->SetString( | 314 dict->SetString( |
| 315 "n", | 315 "n", |
| 316 "qLOyhK-OtQs4cDSoYPFGxJGfMYdjzWxVmMiuSBGh4KvEx-CwgtaTpef87Wdc9GaFEncsDLxk" | 316 "qLOyhK-OtQs4cDSoYPFGxJGfMYdjzWxVmMiuSBGh4KvEx-CwgtaTpef87Wdc9GaFEncsDLxk" |
| 317 "p0LGxjD1M8jMcvYq6DPEC_JYQumEu3i9v5fAEH1VvbZi9cTg-rmEXLUUjvc5LdOq_5OuHmtm" | 317 "p0LGxjD1M8jMcvYq6DPEC_JYQumEu3i9v5fAEH1VvbZi9cTg-rmEXLUUjvc5LdOq_5OuHmtm" |
| 318 "e7PUJHYW1PW6ENTP0ibeiNOfFvs"); | 318 "e7PUJHYW1PW6ENTP0ibeiNOfFvs"); |
| 319 dict->SetString("e", "AQAB"); | 319 dict->SetString("e", "AQAB"); |
| 320 } | 320 } |
| 321 | 321 |
| 322 blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( | |
| 323 blink::WebCryptoAlgorithmId algorithm_id, | |
| 324 blink::WebCryptoAlgorithmId hash_id) { | |
| 325 DCHECK(algorithm_id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 || | |
| 326 algorithm_id == blink::WebCryptoAlgorithmIdRsaOaep); | |
| 327 DCHECK(IsHashAlgorithm(hash_id)); | |
| 328 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( | |
| 329 algorithm_id, | |
| 330 new blink::WebCryptoRsaHashedImportParams(CreateAlgorithm(hash_id))); | |
| 331 } | |
| 332 | |
| 333 // Determines if two ArrayBuffers have identical content. | 322 // Determines if two ArrayBuffers have identical content. |
| 334 bool ArrayBuffersEqual(const blink::WebArrayBuffer& a, | 323 bool ArrayBuffersEqual(const blink::WebArrayBuffer& a, |
| 335 const blink::WebArrayBuffer& b) { | 324 const blink::WebArrayBuffer& b) { |
| 336 return a.byteLength() == b.byteLength() && | 325 return a.byteLength() == b.byteLength() && |
| 337 memcmp(a.data(), b.data(), a.byteLength()) == 0; | 326 memcmp(a.data(), b.data(), a.byteLength()) == 0; |
| 338 } | 327 } |
| 339 | 328 |
| 340 // Given a vector of WebArrayBuffers, determines if there are any copies. | 329 // Given a vector of WebArrayBuffers, determines if there are any copies. |
| 341 bool CopiesExist(std::vector<blink::WebArrayBuffer> bufs) { | 330 bool CopiesExist(std::vector<blink::WebArrayBuffer> bufs) { |
| 342 for (size_t i = 0; i < bufs.size(); ++i) { | 331 for (size_t i = 0; i < bufs.size(); ++i) { |
| (...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 wrapping_algorithm, | 2821 wrapping_algorithm, |
| 2833 key_algorithm, | 2822 key_algorithm, |
| 2834 true, | 2823 true, |
| 2835 blink::WebCryptoKeyUsageSign, | 2824 blink::WebCryptoKeyUsageSign, |
| 2836 &unwrapped_key)); | 2825 &unwrapped_key)); |
| 2837 } | 2826 } |
| 2838 | 2827 |
| 2839 } // namespace webcrypto | 2828 } // namespace webcrypto |
| 2840 | 2829 |
| 2841 } // namespace content | 2830 } // namespace content |
| OLD | NEW |