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

Side by Side Diff: public/platform/WebCryptoAlgorithmParams.h

Issue 284973002: [webcrypto] Remove RSA-ES support (3 of 3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Placate compiler warning on android about uninitialized variable Created 6 years, 7 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 | « public/platform/WebCryptoAlgorithm.h ('k') | public/platform/WebCryptoKeyAlgorithm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 bool hasLengthBits() const { return m_hasLengthBits; } 144 bool hasLengthBits() const { return m_hasLengthBits; }
145 145
146 unsigned optionalLengthBits() const { return m_optionalLengthBits; } 146 unsigned optionalLengthBits() const { return m_optionalLengthBits; }
147 147
148 private: 148 private:
149 const bool m_hasLengthBits; 149 const bool m_hasLengthBits;
150 const unsigned m_optionalLengthBits; 150 const unsigned m_optionalLengthBits;
151 }; 151 };
152 152
153 class WebCryptoRsaKeyGenParams : public WebCryptoAlgorithmParams {
154 public:
155 WebCryptoRsaKeyGenParams(unsigned modulusLengthBits, const unsigned char* pu blicExponent, unsigned publicExponentSize)
156 : m_modulusLengthBits(modulusLengthBits)
157 , m_publicExponent(publicExponent, publicExponentSize)
158 {
159 }
160
161 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaKeyGenParams; }
162
163 unsigned modulusLengthBits() const { return m_modulusLengthBits; }
164 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo nent; }
165
166 private:
167 const unsigned m_modulusLengthBits;
168 const WebVector<unsigned char> m_publicExponent;
169 };
170
171 class WebCryptoAesGcmParams : public WebCryptoAlgorithmParams { 153 class WebCryptoAesGcmParams : public WebCryptoAlgorithmParams {
172 public: 154 public:
173 WebCryptoAesGcmParams(const unsigned char* iv, unsigned ivSize, bool hasAddi tionalData, const unsigned char* additionalData, unsigned additionalDataSize, bo ol hasTagLengthBits, unsigned char tagLengthBits) 155 WebCryptoAesGcmParams(const unsigned char* iv, unsigned ivSize, bool hasAddi tionalData, const unsigned char* additionalData, unsigned additionalDataSize, bo ol hasTagLengthBits, unsigned char tagLengthBits)
174 : m_iv(iv, ivSize) 156 : m_iv(iv, ivSize)
175 , m_hasAdditionalData(hasAdditionalData) 157 , m_hasAdditionalData(hasAdditionalData)
176 , m_optionalAdditionalData(additionalData, additionalDataSize) 158 , m_optionalAdditionalData(additionalData, additionalDataSize)
177 , m_hasTagLengthBits(hasTagLengthBits) 159 , m_hasTagLengthBits(hasTagLengthBits)
178 , m_optionalTagLengthBits(tagLengthBits) 160 , m_optionalTagLengthBits(tagLengthBits)
179 { 161 {
180 BLINK_ASSERT(hasAdditionalData || !additionalDataSize); 162 BLINK_ASSERT(hasAdditionalData || !additionalDataSize);
(...skipping 21 matching lines...) Expand all
202 class WebCryptoRsaHashedImportParams : public WebCryptoAlgorithmParamsWithHash { 184 class WebCryptoRsaHashedImportParams : public WebCryptoAlgorithmParamsWithHash {
203 public: 185 public:
204 explicit WebCryptoRsaHashedImportParams(const WebCryptoAlgorithm& hash) 186 explicit WebCryptoRsaHashedImportParams(const WebCryptoAlgorithm& hash)
205 : WebCryptoAlgorithmParamsWithHash(hash) 187 : WebCryptoAlgorithmParamsWithHash(hash)
206 { 188 {
207 } 189 }
208 190
209 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedImportParams; } 191 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedImportParams; }
210 }; 192 };
211 193
212 class WebCryptoRsaHashedKeyGenParams : public WebCryptoRsaKeyGenParams { 194 class WebCryptoRsaHashedKeyGenParams : public WebCryptoAlgorithmParams {
213 public: 195 public:
214 explicit WebCryptoRsaHashedKeyGenParams(const WebCryptoAlgorithm& hash, unsi gned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExpo nentSize) 196 explicit WebCryptoRsaHashedKeyGenParams(const WebCryptoAlgorithm& hash, unsi gned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExpo nentSize)
215 : WebCryptoRsaKeyGenParams(modulusLengthBits, publicExponent, publicExpo nentSize) 197 : m_modulusLengthBits(modulusLengthBits)
198 , m_publicExponent(publicExponent, publicExponentSize)
216 , m_hash(hash) 199 , m_hash(hash)
217 { 200 {
218 BLINK_ASSERT(!hash.isNull()); 201 BLINK_ASSERT(!hash.isNull());
219 } 202 }
220 203
221 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedKeyGenParams; } 204 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedKeyGenParams; }
222 205
206 unsigned modulusLengthBits() const { return m_modulusLengthBits; }
207 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo nent; }
223 const WebCryptoAlgorithm& hash() const { return m_hash; } 208 const WebCryptoAlgorithm& hash() const { return m_hash; }
224 209
225 private: 210 private:
211 const unsigned m_modulusLengthBits;
212 const WebVector<unsigned char> m_publicExponent;
226 const WebCryptoAlgorithm m_hash; 213 const WebCryptoAlgorithm m_hash;
227 }; 214 };
228 215
229 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams { 216 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams {
230 public: 217 public:
231 WebCryptoRsaOaepParams(bool hasLabel, const unsigned char* label, unsigned l abelSize) 218 WebCryptoRsaOaepParams(bool hasLabel, const unsigned char* label, unsigned l abelSize)
232 : m_hasLabel(hasLabel) 219 : m_hasLabel(hasLabel)
233 , m_optionalLabel(label, labelSize) 220 , m_optionalLabel(label, labelSize)
234 { 221 {
235 BLINK_ASSERT(hasLabel || !labelSize); 222 BLINK_ASSERT(hasLabel || !labelSize);
236 } 223 }
237 224
238 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaOaepParams; } 225 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaOaepParams; }
239 226
240 bool hasLabel() const { return m_hasLabel; } 227 bool hasLabel() const { return m_hasLabel; }
241 const WebVector<unsigned char>& optionalLabel() const { return m_optionalLab el; } 228 const WebVector<unsigned char>& optionalLabel() const { return m_optionalLab el; }
242 229
243 private: 230 private:
244 const bool m_hasLabel; 231 const bool m_hasLabel;
245 const WebVector<unsigned char> m_optionalLabel; 232 const WebVector<unsigned char> m_optionalLabel;
246 }; 233 };
247 234
248 } // namespace blink 235 } // namespace blink
249 236
250 #endif 237 #endif
OLDNEW
« no previous file with comments | « public/platform/WebCryptoAlgorithm.h ('k') | public/platform/WebCryptoKeyAlgorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698