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

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

Issue 141853006: [webcrypto] Validate JWK import of AES keys: key length must match algorithm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 static Status ErrorJwkAlgorithmMissing(); 76 static Status ErrorJwkAlgorithmMissing();
77 77
78 // The "use" parameter was specified, however it couldn't be converted to an 78 // The "use" parameter was specified, however it couldn't be converted to an
79 // equivalent Web Crypto usage. 79 // equivalent Web Crypto usage.
80 static Status ErrorJwkUnrecognizedUsage(); 80 static Status ErrorJwkUnrecognizedUsage();
81 81
82 // The "use" parameter was specified, however it is incompatible with that 82 // The "use" parameter was specified, however it is incompatible with that
83 // specified by the Web Crypto import operation. 83 // specified by the Web Crypto import operation.
84 static Status ErrorJwkUsageInconsistent(); 84 static Status ErrorJwkUsageInconsistent();
85 85
86 // The "k" parameter was either missing, could not be parsed as a base-64 86 // The "k" parameter was either missing or could not be parsed as a base-64
87 // encoded string, or the decoded bytes were empty. 87 // encoded string.
88 static Status ErrorJwkDecodeK(); 88 static Status ErrorJwkDecodeK();
89 89
90 // The "n" parameter was either missing, could not be parsed as a base-64 90 // The "n" parameter was either missing or could not be parsed as a base-64
91 // encoded string, or the decoded bytes were empty. 91 // encoded string.
92 static Status ErrorJwkDecodeN(); 92 static Status ErrorJwkDecodeN();
93 93
94 // The "e" parameter was either missing, could not be parsed as a base-64 94 // The "e" parameter was either missing or could not be parsed as a base-64
95 // encoded string, or the decoded bytes were empty. 95 // encoded string.
96 static Status ErrorJwkDecodeE(); 96 static Status ErrorJwkDecodeE();
97 97
98 // TODO(eroman): Private key import through JWK is not yet supported. 98 // TODO(eroman): Private key import through JWK is not yet supported.
99 static Status ErrorJwkRsaPrivateKeyUnsupported(); 99 static Status ErrorJwkRsaPrivateKeyUnsupported();
100 100
101 // The "kty" parameter was given and was a string, however it was 101 // The "kty" parameter was given and was a string, however it was
102 // unrecognized. 102 // unrecognized.
103 static Status ErrorJwkUnrecognizedKty(); 103 static Status ErrorJwkUnrecognizedKty();
104 104
105 // The amount of key data provided was incompatible with the selected
106 // algorithm. For instance if the algorith name was A128CBC then EXACTLY
107 // 128-bits of key data must have been provided. If 192-bits of key data were
108 // given that is an error.
109 static Status ErrorJwkIncorrectKeyLength();
110
105 // ------------------------------------ 111 // ------------------------------------
106 // Other errors 112 // Other errors
107 // ------------------------------------ 113 // ------------------------------------
108 114
109 // No key data was provided when importing an spki, pkcs8, or jwk formatted 115 // No key data was provided when importing an spki, pkcs8, or jwk formatted
110 // key. This does not apply to raw format, since it is possible to have empty 116 // key. This does not apply to raw format, since it is possible to have empty
111 // key data there. 117 // key data there.
112 static Status ErrorImportEmptyKeyData(); 118 static Status ErrorImportEmptyKeyData();
113 119
114 // The wrong key was used for the operation. For instance, a public key was 120 // The wrong key was used for the operation. For instance, a public key was
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 uint8 tag_length_bytes); 252 uint8 tag_length_bytes);
247 253
248 // Returns the internal block size for SHA-* 254 // Returns the internal block size for SHA-*
249 unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id); 255 unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id);
250 256
251 } // namespace webcrypto 257 } // namespace webcrypto
252 258
253 } // namespace content 259 } // namespace content
254 260
255 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 261 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
OLDNEW
« no previous file with comments | « content/renderer/webcrypto/webcrypto_impl_unittest.cc ('k') | content/renderer/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698