| 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 "components/webcrypto/jwk.h" | 5 #include "components/webcrypto/jwk.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 return Status::Success(); | 347 return Status::Success(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 JwkWriter::JwkWriter(const std::string& algorithm, | 350 JwkWriter::JwkWriter(const std::string& algorithm, |
| 351 bool extractable, | 351 bool extractable, |
| 352 blink::WebCryptoKeyUsageMask usages, | 352 blink::WebCryptoKeyUsageMask usages, |
| 353 const std::string& kty) { | 353 const std::string& kty) { |
| 354 if (!algorithm.empty()) | 354 if (!algorithm.empty()) |
| 355 dict_.SetString("alg", algorithm); | 355 dict_.SetString("alg", algorithm); |
| 356 dict_.Set("key_ops", CreateJwkKeyOpsFromWebCryptoUsages(usages).release()); | 356 dict_.Set("key_ops", CreateJwkKeyOpsFromWebCryptoUsages(usages)); |
| 357 dict_.SetBoolean("ext", extractable); | 357 dict_.SetBoolean("ext", extractable); |
| 358 dict_.SetString("kty", kty); | 358 dict_.SetString("kty", kty); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void JwkWriter::SetString(const std::string& member_name, | 361 void JwkWriter::SetString(const std::string& member_name, |
| 362 const std::string& value) { | 362 const std::string& value) { |
| 363 dict_.SetString(member_name, value); | 363 dict_.SetString(member_name, value); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void JwkWriter::SetBytes(const std::string& member_name, | 366 void JwkWriter::SetBytes(const std::string& member_name, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 382 utf8_bytes->assign(json.begin(), json.end()); | 382 utf8_bytes->assign(json.begin(), json.end()); |
| 383 } | 383 } |
| 384 | 384 |
| 385 Status GetWebCryptoUsagesFromJwkKeyOpsForTest( | 385 Status GetWebCryptoUsagesFromJwkKeyOpsForTest( |
| 386 const base::ListValue* key_ops, | 386 const base::ListValue* key_ops, |
| 387 blink::WebCryptoKeyUsageMask* usages) { | 387 blink::WebCryptoKeyUsageMask* usages) { |
| 388 return GetWebCryptoUsagesFromJwkKeyOps(key_ops, usages); | 388 return GetWebCryptoUsagesFromJwkKeyOps(key_ops, usages); |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace webcrypto | 391 } // namespace webcrypto |
| OLD | NEW |