| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // Defines a map between a JWK 'alg' string ID and a corresponding Web Crypto | 50 // Defines a map between a JWK 'alg' string ID and a corresponding Web Crypto |
| 51 // factory function. | 51 // factory function. |
| 52 typedef blink::WebCryptoAlgorithm (*AlgFactoryFuncNoArgs)(); | 52 typedef blink::WebCryptoAlgorithm (*AlgFactoryFuncNoArgs)(); |
| 53 typedef std::map<std::string, AlgFactoryFuncNoArgs> JwkAlgFactoryMap; | 53 typedef std::map<std::string, AlgFactoryFuncNoArgs> JwkAlgFactoryMap; |
| 54 | 54 |
| 55 class JwkAlgorithmFactoryMap { | 55 class JwkAlgorithmFactoryMap { |
| 56 public: | 56 public: |
| 57 JwkAlgorithmFactoryMap() { | 57 JwkAlgorithmFactoryMap() { |
| 58 map_["HS256"] = | 58 map_["HS256"] = |
| 59 &BindAlgFactoryWithKeyLen<webcrypto::CreateHmacAlgorithmByHashOutputLen, | 59 &BindAlgFactoryAlgorithmId<webcrypto::CreateHmacAlgorithmByHashId, |
| 60 256>; | 60 blink::WebCryptoAlgorithmIdSha256>; |
| 61 map_["HS384"] = | 61 map_["HS384"] = |
| 62 &BindAlgFactoryWithKeyLen<webcrypto::CreateHmacAlgorithmByHashOutputLen, | 62 &BindAlgFactoryAlgorithmId<webcrypto::CreateHmacAlgorithmByHashId, |
| 63 384>; | 63 blink::WebCryptoAlgorithmIdSha384>; |
| 64 map_["HS512"] = | 64 map_["HS512"] = |
| 65 &BindAlgFactoryWithKeyLen<webcrypto::CreateHmacAlgorithmByHashOutputLen, | 65 &BindAlgFactoryAlgorithmId<webcrypto::CreateHmacAlgorithmByHashId, |
| 66 512>; | 66 blink::WebCryptoAlgorithmIdSha512>; |
| 67 map_["RS256"] = | 67 map_["RS256"] = |
| 68 &BindAlgFactoryAlgorithmId<webcrypto::CreateRsaSsaAlgorithm, | 68 &BindAlgFactoryAlgorithmId<webcrypto::CreateRsaSsaAlgorithm, |
| 69 blink::WebCryptoAlgorithmIdSha256>; | 69 blink::WebCryptoAlgorithmIdSha256>; |
| 70 map_["RS384"] = | 70 map_["RS384"] = |
| 71 &BindAlgFactoryAlgorithmId<webcrypto::CreateRsaSsaAlgorithm, | 71 &BindAlgFactoryAlgorithmId<webcrypto::CreateRsaSsaAlgorithm, |
| 72 blink::WebCryptoAlgorithmIdSha384>; | 72 blink::WebCryptoAlgorithmIdSha384>; |
| 73 map_["RS512"] = | 73 map_["RS512"] = |
| 74 &BindAlgFactoryAlgorithmId<webcrypto::CreateRsaSsaAlgorithm, | 74 &BindAlgFactoryAlgorithmId<webcrypto::CreateRsaSsaAlgorithm, |
| 75 blink::WebCryptoAlgorithmIdSha512>; | 75 blink::WebCryptoAlgorithmIdSha512>; |
| 76 map_["RSA1_5"] = | 76 map_["RSA1_5"] = |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 key); | 622 key); |
| 623 | 623 |
| 624 } else { | 624 } else { |
| 625 return false; | 625 return false; |
| 626 } | 626 } |
| 627 | 627 |
| 628 return true; | 628 return true; |
| 629 } | 629 } |
| 630 | 630 |
| 631 } // namespace content | 631 } // namespace content |
| OLD | NEW |