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

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

Issue 379383002: Refactor WebCrypto code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto master (no longer has BoringSSL) 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_impl.cc ('k') | content/child/webcrypto/webcrypto_util.cc » ('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 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_
6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // algorithm that is not SHA*. 60 // algorithm that is not SHA*.
61 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( 61 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateHmacImportAlgorithm(
62 blink::WebCryptoAlgorithmId hash_id); 62 blink::WebCryptoAlgorithmId hash_id);
63 63
64 // Creates an import algorithm for RSA algorithms that take a hash. 64 // Creates an import algorithm for RSA algorithms that take a hash.
65 // It is an error to call this with a hash_id that is not a SHA*. 65 // It is an error to call this with a hash_id that is not a SHA*.
66 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( 66 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm(
67 blink::WebCryptoAlgorithmId id, 67 blink::WebCryptoAlgorithmId id,
68 blink::WebCryptoAlgorithmId hash_id); 68 blink::WebCryptoAlgorithmId hash_id);
69 69
70 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm,
71 unsigned int keylen_bytes,
72 blink::WebCryptoKeyAlgorithm* key_algorithm);
73
74 // Returns true if the set bits in b make up a subset of the set bits in a. 70 // Returns true if the set bits in b make up a subset of the set bits in a.
75 bool ContainsKeyUsages(blink::WebCryptoKeyUsageMask a, 71 bool ContainsKeyUsages(blink::WebCryptoKeyUsageMask a,
76 blink::WebCryptoKeyUsageMask b); 72 blink::WebCryptoKeyUsageMask b);
77 73
74 bool KeyUsageAllows(const blink::WebCryptoKey& key,
75 const blink::WebCryptoKeyUsage usage);
76
78 bool IsAlgorithmRsa(blink::WebCryptoAlgorithmId alg_id); 77 bool IsAlgorithmRsa(blink::WebCryptoAlgorithmId alg_id);
79 bool IsAlgorithmAsymmetric(blink::WebCryptoAlgorithmId alg_id); 78 bool IsAlgorithmAsymmetric(blink::WebCryptoAlgorithmId alg_id);
80 79
80 Status GetAesGcmTagLengthInBits(const blink::WebCryptoAesGcmParams* params,
81 unsigned int* tag_length_bits);
82
83 Status GetAesKeyGenLengthInBits(const blink::WebCryptoAesKeyGenParams* params,
84 unsigned int* keylen_bits);
85
86 Status GetHmacKeyGenLengthInBits(const blink::WebCryptoHmacKeyGenParams* params,
87 unsigned int* keylen_bits);
88
89 Status VerifyAesKeyLengthForImport(unsigned int keylen_bytes);
90
91 Status CheckKeyCreationUsages(blink::WebCryptoKeyUsageMask all_possible_usages,
92 blink::WebCryptoKeyUsageMask actual_usages);
93
81 } // namespace webcrypto 94 } // namespace webcrypto
82 95
83 } // namespace content 96 } // namespace content
84 97
85 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 98 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_
OLDNEW
« no previous file with comments | « content/child/webcrypto/webcrypto_impl.cc ('k') | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698