| 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 "jwk.h" | 5 #include "jwk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 return !algorithm->isNull(); | 258 return !algorithm->isNull(); |
| 259 } | 259 } |
| 260 | 260 |
| 261 bool IsInvalidKeyByteLength(size_t byte_length) const { | 261 bool IsInvalidKeyByteLength(size_t byte_length) const { |
| 262 if (required_key_length_bytes_ == NO_KEY_SIZE_REQUIREMENT) | 262 if (required_key_length_bytes_ == NO_KEY_SIZE_REQUIREMENT) |
| 263 return false; | 263 return false; |
| 264 return required_key_length_bytes_ != byte_length; | 264 return required_key_length_bytes_ != byte_length; |
| 265 } | 265 } |
| 266 | 266 |
| 267 private: | 267 private: |
| 268 enum { NO_KEY_SIZE_REQUIREMENT = UINT_MAX }; | 268 static const unsigned int NO_KEY_SIZE_REQUIREMENT = UINT_MAX; |
| 269 | 269 |
| 270 AlgorithmCreationFunc creation_func_; | 270 AlgorithmCreationFunc creation_func_; |
| 271 | 271 |
| 272 // The expected key size for the algorithm or NO_KEY_SIZE_REQUIREMENT. | 272 // The expected key size for the algorithm or NO_KEY_SIZE_REQUIREMENT. |
| 273 unsigned int required_key_length_bytes_; | 273 unsigned int required_key_length_bytes_; |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 typedef std::map<std::string, JwkAlgorithmInfo> JwkAlgorithmInfoMap; | 276 typedef std::map<std::string, JwkAlgorithmInfo> JwkAlgorithmInfoMap; |
| 277 | 277 |
| 278 class JwkAlgorithmRegistry { | 278 class JwkAlgorithmRegistry { |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 1009 |
| 1010 std::string json; | 1010 std::string json; |
| 1011 base::JSONWriter::Write(&jwk_dict, &json); | 1011 base::JSONWriter::Write(&jwk_dict, &json); |
| 1012 buffer->assign(json.data(), json.data() + json.size()); | 1012 buffer->assign(json.data(), json.data() + json.size()); |
| 1013 return Status::Success(); | 1013 return Status::Success(); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 } // namespace webcrypto | 1016 } // namespace webcrypto |
| 1017 | 1017 |
| 1018 } // namespace content | 1018 } // namespace content |
| OLD | NEW |