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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 dict->SetString("use", "enc"); | 297 dict->SetString("use", "enc"); |
298 dict->SetBoolean("extractable", false); | 298 dict->SetBoolean("extractable", false); |
299 dict->SetString( | 299 dict->SetString( |
300 "n", | 300 "n", |
301 "qLOyhK-OtQs4cDSoYPFGxJGfMYdjzWxVmMiuSBGh4KvEx-CwgtaTpef87Wdc9GaFEncsDLxk" | 301 "qLOyhK-OtQs4cDSoYPFGxJGfMYdjzWxVmMiuSBGh4KvEx-CwgtaTpef87Wdc9GaFEncsDLxk" |
302 "p0LGxjD1M8jMcvYq6DPEC_JYQumEu3i9v5fAEH1VvbZi9cTg-rmEXLUUjvc5LdOq_5OuHmtm" | 302 "p0LGxjD1M8jMcvYq6DPEC_JYQumEu3i9v5fAEH1VvbZi9cTg-rmEXLUUjvc5LdOq_5OuHmtm" |
303 "e7PUJHYW1PW6ENTP0ibeiNOfFvs"); | 303 "e7PUJHYW1PW6ENTP0ibeiNOfFvs"); |
304 dict->SetString("e", "AQAB"); | 304 dict->SetString("e", "AQAB"); |
305 } | 305 } |
306 | 306 |
307 blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( | |
308 blink::WebCryptoAlgorithmId algorithm_id, | |
309 blink::WebCryptoAlgorithmId hash_id) { | |
310 DCHECK(algorithm_id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 || | |
311 algorithm_id == blink::WebCryptoAlgorithmIdRsaOaep); | |
312 DCHECK(IsHashAlgorithm(hash_id)); | |
313 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( | |
314 algorithm_id, | |
315 new blink::WebCryptoRsaHashedImportParams(CreateAlgorithm(hash_id))); | |
316 } | |
317 | |
318 // Determines if two ArrayBuffers have identical content. | 307 // Determines if two ArrayBuffers have identical content. |
319 bool ArrayBuffersEqual(const blink::WebArrayBuffer& a, | 308 bool ArrayBuffersEqual(const blink::WebArrayBuffer& a, |
320 const blink::WebArrayBuffer& b) { | 309 const blink::WebArrayBuffer& b) { |
321 return a.byteLength() == b.byteLength() && | 310 return a.byteLength() == b.byteLength() && |
322 memcmp(a.data(), b.data(), a.byteLength()) == 0; | 311 memcmp(a.data(), b.data(), a.byteLength()) == 0; |
323 } | 312 } |
324 | 313 |
325 // Given a vector of WebArrayBuffers, determines if there are any copies. | 314 // Given a vector of WebArrayBuffers, determines if there are any copies. |
326 bool CopiesExist(std::vector<blink::WebArrayBuffer> bufs) { | 315 bool CopiesExist(std::vector<blink::WebArrayBuffer> bufs) { |
327 for (size_t i = 0; i < bufs.size(); ++i) { | 316 for (size_t i = 0; i < bufs.size(); ++i) { |
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 test_cipher_text, | 2291 test_cipher_text, |
2303 test_authentication_tag, | 2292 test_authentication_tag, |
2304 &plain_text)); | 2293 &plain_text)); |
2305 } | 2294 } |
2306 } | 2295 } |
2307 } | 2296 } |
2308 | 2297 |
2309 } // namespace webcrypto | 2298 } // namespace webcrypto |
2310 | 2299 |
2311 } // namespace content | 2300 } // namespace content |
OLD | NEW |