Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(967)

Side by Side Diff: content/child/webcrypto/webcrypto_util.cc

Issue 267323009: [webcrypto] Add deriveBits key_op to JWK import/export. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/child/webcrypto/jwk.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_util.h" 5 #include "content/child/webcrypto/webcrypto_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/child/webcrypto/status.h" 10 #include "content/child/webcrypto/status.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 struct JwkToWebCryptoUsage { 61 struct JwkToWebCryptoUsage {
62 const char* const jwk_key_op; 62 const char* const jwk_key_op;
63 const blink::WebCryptoKeyUsage webcrypto_usage; 63 const blink::WebCryptoKeyUsage webcrypto_usage;
64 }; 64 };
65 65
66 const JwkToWebCryptoUsage kJwkWebCryptoUsageMap[] = { 66 const JwkToWebCryptoUsage kJwkWebCryptoUsageMap[] = {
67 {"encrypt", blink::WebCryptoKeyUsageEncrypt}, 67 {"encrypt", blink::WebCryptoKeyUsageEncrypt},
68 {"decrypt", blink::WebCryptoKeyUsageDecrypt}, 68 {"decrypt", blink::WebCryptoKeyUsageDecrypt},
69 {"deriveKey", blink::WebCryptoKeyUsageDeriveKey}, 69 {"deriveKey", blink::WebCryptoKeyUsageDeriveKey},
70 // TODO(padolph): Add 'deriveBits' once supported by Blink. 70 {"deriveBits", blink::WebCryptoKeyUsageDeriveBits},
71 {"sign", blink::WebCryptoKeyUsageSign}, 71 {"sign", blink::WebCryptoKeyUsageSign},
72 {"unwrapKey", blink::WebCryptoKeyUsageUnwrapKey}, 72 {"unwrapKey", blink::WebCryptoKeyUsageUnwrapKey},
73 {"verify", blink::WebCryptoKeyUsageVerify}, 73 {"verify", blink::WebCryptoKeyUsageVerify},
74 {"wrapKey", blink::WebCryptoKeyUsageWrapKey}}; 74 {"wrapKey", blink::WebCryptoKeyUsageWrapKey}};
75 75
76 // Modifies the input usage_mask by according to the key_op value. 76 // Modifies the input usage_mask by according to the key_op value.
77 bool JwkKeyOpToWebCryptoUsage(const std::string& key_op, 77 bool JwkKeyOpToWebCryptoUsage(const std::string& key_op,
78 blink::WebCryptoKeyUsageMask* usage_mask) { 78 blink::WebCryptoKeyUsageMask* usage_mask) {
79 for (size_t i = 0; i < arraysize(kJwkWebCryptoUsageMap); ++i) { 79 for (size_t i = 0; i < arraysize(kJwkWebCryptoUsageMap); ++i) {
80 if (kJwkWebCryptoUsageMap[i].jwk_key_op == key_op) { 80 if (kJwkWebCryptoUsageMap[i].jwk_key_op == key_op) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 algorithm.id(), keylen_bytes * 8); 175 algorithm.id(), keylen_bytes * 8);
176 return true; 176 return true;
177 default: 177 default:
178 return false; 178 return false;
179 } 179 }
180 } 180 }
181 181
182 } // namespace webcrypto 182 } // namespace webcrypto
183 183
184 } // namespace content 184 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/jwk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698