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

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: rebase and refactor 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, 259 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm,
247 unsigned keylen_bytes, 260 unsigned keylen_bytes,
248 blink::WebCryptoAlgorithm* key_algorithm); 261 blink::WebCryptoAlgorithm* key_algorithm);
249 #endif 262 #endif
250 263
251 } // namespace webcrypto 264 } // namespace webcrypto
252 265
253 } // namespace content 266 } // namespace content
254 267
255 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 268 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698