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

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

Issue 379383002: Refactor WebCrypto code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put JWK rsa parameters into a struct Created 6 years, 5 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/webcrypto_util.h ('k') | content/content_child.gypi » ('j') | 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 default: 184 default:
185 return false; 185 return false;
186 } 186 }
187 } 187 }
188 188
189 bool ContainsKeyUsages(blink::WebCryptoKeyUsageMask a, 189 bool ContainsKeyUsages(blink::WebCryptoKeyUsageMask a,
190 blink::WebCryptoKeyUsageMask b) { 190 blink::WebCryptoKeyUsageMask b) {
191 return (a & b) == b; 191 return (a & b) == b;
192 } 192 }
193 193
194 // TODO(eroman): Move this helper to WebCryptoKey.
195 bool KeyUsageAllows(const blink::WebCryptoKey& key,
196 const blink::WebCryptoKeyUsage usage) {
197 return ((key.usages() & usage) != 0);
198 }
199
194 bool IsAlgorithmRsa(blink::WebCryptoAlgorithmId alg_id) { 200 bool IsAlgorithmRsa(blink::WebCryptoAlgorithmId alg_id) {
195 return alg_id == blink::WebCryptoAlgorithmIdRsaOaep || 201 return alg_id == blink::WebCryptoAlgorithmIdRsaOaep ||
196 alg_id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5; 202 alg_id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5;
197 } 203 }
198 204
199 bool IsAlgorithmAsymmetric(blink::WebCryptoAlgorithmId alg_id) { 205 bool IsAlgorithmAsymmetric(blink::WebCryptoAlgorithmId alg_id) {
200 // TODO(padolph): include all other asymmetric algorithms once they are 206 // TODO(padolph): include all other asymmetric algorithms once they are
201 // defined, e.g. EC and DH. 207 // defined, e.g. EC and DH.
202 return IsAlgorithmRsa(alg_id); 208 return IsAlgorithmRsa(alg_id);
203 } 209 }
204 210
205 } // namespace webcrypto 211 } // namespace webcrypto
206 212
207 } // namespace content 213 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/webcrypto_util.h ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698