| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (status.IsError()) { | 130 if (status.IsError()) { |
| 131 CompleteWithError(status, result); | 131 CompleteWithError(status, result); |
| 132 } else { | 132 } else { |
| 133 result->completeWithKey(key); | 133 result->completeWithKey(key); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool IsAlgorithmAsymmetric(const blink::WebCryptoAlgorithm& algorithm) { | 137 bool IsAlgorithmAsymmetric(const blink::WebCryptoAlgorithm& algorithm) { |
| 138 // TODO(padolph): include all other asymmetric algorithms once they are | 138 // TODO(padolph): include all other asymmetric algorithms once they are |
| 139 // defined, e.g. EC and DH. | 139 // defined, e.g. EC and DH. |
| 140 return (algorithm.id() == blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5 || | 140 return webcrypto::IsAlgorithmRsa(algorithm.id()); |
| 141 algorithm.id() == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 || | |
| 142 algorithm.id() == blink::WebCryptoAlgorithmIdRsaOaep); | |
| 143 } | 141 } |
| 144 | 142 |
| 145 // Gets a task runner for the current thread. The current thread is either: | 143 // Gets a task runner for the current thread. The current thread is either: |
| 146 // | 144 // |
| 147 // * The main Blink thread | 145 // * The main Blink thread |
| 148 // * A Blink web worker thread | 146 // * A Blink web worker thread |
| 149 // | 147 // |
| 150 // A different mechanism is needed for posting to these threads. The main | 148 // A different mechanism is needed for posting to these threads. The main |
| 151 // thread has an associated message loop and can simply use | 149 // thread has an associated message loop and can simply use |
| 152 // base::ThreadTaskRunnerHandle. Whereas the web worker threads are managed by | 150 // base::ThreadTaskRunnerHandle. Whereas the web worker threads are managed by |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 &key); | 737 &key); |
| 740 } | 738 } |
| 741 | 739 |
| 742 bool WebCryptoImpl::serializeKeyForClone( | 740 bool WebCryptoImpl::serializeKeyForClone( |
| 743 const blink::WebCryptoKey& key, | 741 const blink::WebCryptoKey& key, |
| 744 blink::WebVector<unsigned char>& key_data) { | 742 blink::WebVector<unsigned char>& key_data) { |
| 745 return webcrypto::SerializeKeyForClone(key, &key_data); | 743 return webcrypto::SerializeKeyForClone(key, &key_data); |
| 746 } | 744 } |
| 747 | 745 |
| 748 } // namespace content | 746 } // namespace content |
| OLD | NEW |