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

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

Issue 118623002: [webcrypto] Add raw symmetric key AES-KW wrap/unwrap for NSS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed ASSERTS from last change to EXPECTS, to match original code intent Created 6 years, 9 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
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // bytes. 128 // bytes.
129 static Status ErrorIncorrectSizeAesCbcIv(); 129 static Status ErrorIncorrectSizeAesCbcIv();
130 130
131 // The data provided to an encrypt/decrypt/sign/verify operation was too 131 // The data provided to an encrypt/decrypt/sign/verify operation was too
132 // large. This can either represent an internal limitation (for instance 132 // large. This can either represent an internal limitation (for instance
133 // representing buffer lengths as uints), or an algorithm restriction (for 133 // representing buffer lengths as uints), or an algorithm restriction (for
134 // instance RSAES can operation on messages relative to the length of the 134 // instance RSAES can operation on messages relative to the length of the
135 // key's modulus). 135 // key's modulus).
136 static Status ErrorDataTooLarge(); 136 static Status ErrorDataTooLarge();
137 137
138 // The data provided to an encrypt/decrypt/sign/verify operation was too
139 // small. This usually represents an algorithm restriction (for instance
140 // AES-KW requires a minimum of 24 bytes input data).
141 static Status ErrorDataTooSmall();
142
138 // Something was unsupported or unimplemented. This can mean the algorithm in 143 // Something was unsupported or unimplemented. This can mean the algorithm in
139 // question was unsupported, some parameter combination was unsupported, or 144 // question was unsupported, some parameter combination was unsupported, or
140 // something has not yet been implemented. 145 // something has not yet been implemented.
141 static Status ErrorUnsupported(); 146 static Status ErrorUnsupported();
142 147
143 // Something unexpected happened in the code, which implies there is a 148 // Something unexpected happened in the code, which implies there is a
144 // source-level bug. These should not happen, but safer to fail than simply 149 // source-level bug. These should not happen, but safer to fail than simply
145 // DCHECK. 150 // DCHECK.
146 static Status ErrorUnexpected(); 151 static Status ErrorUnexpected();
147 152
148 // The authentication tag length specified for AES-GCM encrypt/decrypt was 153 // The authentication tag length specified for AES-GCM encrypt/decrypt was
149 // not 32, 64, 96, 104, 112, 120, or 128. 154 // not 32, 64, 96, 104, 112, 120, or 128.
150 static Status ErrorInvalidAesGcmTagLength(); 155 static Status ErrorInvalidAesGcmTagLength();
151 156
157 // The input data given to an AES-KW encrypt/decrypt operation was not a
158 // multiple of 8 bytes, as required by RFC 3394.
159 static Status ErrorInvalidAesKwDataLength();
160
152 // The "publicExponent" used to generate a key was invalid: either no bytes 161 // The "publicExponent" used to generate a key was invalid: either no bytes
153 // were specified, or the number was too large to fit into an "unsigned long" 162 // were specified, or the number was too large to fit into an "unsigned long"
154 // (implemention limitation), or the exponent was zero. 163 // (implemention limitation), or the exponent was zero.
155 static Status ErrorGenerateKeyPublicExponent(); 164 static Status ErrorGenerateKeyPublicExponent();
156 165
157 // The algorithm was null when importing a raw-formatted key. In this case it 166 // The algorithm was null when importing a raw-formatted key. In this case it
158 // is required. 167 // is required.
159 static Status ErrorMissingAlgorithmImportRawKey(); 168 static Status ErrorMissingAlgorithmImportRawKey();
160 169
170 // The algorithm was null when unwrapping a raw-formatted key. In this case it
171 // is required.
172 static Status ErrorMissingAlgorithmUnwrapRawKey();
173
161 // The modulus bytes were empty when importing an RSA public key. 174 // The modulus bytes were empty when importing an RSA public key.
162 static Status ErrorImportRsaEmptyModulus(); 175 static Status ErrorImportRsaEmptyModulus();
163 176
164 // The the modulus length was zero bits when generating an RSA public key. 177 // The the modulus length was zero bits when generating an RSA public key.
165 static Status ErrorGenerateRsaZeroModulus(); 178 static Status ErrorGenerateRsaZeroModulus();
166 179
167 // The exponent bytes were empty when importing an RSA public key. 180 // The exponent bytes were empty when importing an RSA public key.
168 static Status ErrorImportRsaEmptyExponent(); 181 static Status ErrorImportRsaEmptyExponent();
169 182
170 // An unextractable key was used by an operation which exports the key data. 183 // An unextractable key was used by an operation which exports the key data.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 253
241 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, 254 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm,
242 unsigned keylen_bytes, 255 unsigned keylen_bytes,
243 blink::WebCryptoKeyAlgorithm* key_algorithm); 256 blink::WebCryptoKeyAlgorithm* key_algorithm);
244 257
245 } // namespace webcrypto 258 } // namespace webcrypto
246 259
247 } // namespace content 260 } // namespace content
248 261
249 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 262 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
OLDNEW
« no previous file with comments | « content/renderer/webcrypto/shared_crypto_unittest.cc ('k') | content/renderer/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698