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

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

Issue 296333002: Revert 174726 "[webcrypto] Remove RSA-ES support (3 of 3)" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: 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
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
153 class WebCryptoAesGcmParams : public WebCryptoAlgorithmParams { 171 class WebCryptoAesGcmParams : public WebCryptoAlgorithmParams {
154 public: 172 public:
155 WebCryptoAesGcmParams(const unsigned char* iv, unsigned ivSize, bool hasAddi tionalData, const unsigned char* additionalData, unsigned additionalDataSize, bo ol hasTagLengthBits, unsigned char tagLengthBits) 173 WebCryptoAesGcmParams(const unsigned char* iv, unsigned ivSize, bool hasAddi tionalData, const unsigned char* additionalData, unsigned additionalDataSize, bo ol hasTagLengthBits, unsigned char tagLengthBits)
156 : m_iv(iv, ivSize) 174 : m_iv(iv, ivSize)
157 , m_hasAdditionalData(hasAdditionalData) 175 , m_hasAdditionalData(hasAdditionalData)
158 , m_optionalAdditionalData(additionalData, additionalDataSize) 176 , m_optionalAdditionalData(additionalData, additionalDataSize)
159 , m_hasTagLengthBits(hasTagLengthBits) 177 , m_hasTagLengthBits(hasTagLengthBits)
160 , m_optionalTagLengthBits(tagLengthBits) 178 , m_optionalTagLengthBits(tagLengthBits)
161 { 179 {
162 BLINK_ASSERT(hasAdditionalData || !additionalDataSize); 180 BLINK_ASSERT(hasAdditionalData || !additionalDataSize);
(...skipping 21 matching lines...) Expand all
184 class WebCryptoRsaHashedImportParams : public WebCryptoAlgorithmParamsWithHash { 202 class WebCryptoRsaHashedImportParams : public WebCryptoAlgorithmParamsWithHash {
185 public: 203 public:
186 explicit WebCryptoRsaHashedImportParams(const WebCryptoAlgorithm& hash) 204 explicit WebCryptoRsaHashedImportParams(const WebCryptoAlgorithm& hash)
187 : WebCryptoAlgorithmParamsWithHash(hash) 205 : WebCryptoAlgorithmParamsWithHash(hash)
188 { 206 {
189 } 207 }
190 208
191 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedImportParams; } 209 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedImportParams; }
192 }; 210 };
193 211
194 class WebCryptoRsaHashedKeyGenParams : public WebCryptoAlgorithmParams { 212 class WebCryptoRsaHashedKeyGenParams : public WebCryptoRsaKeyGenParams {
195 public: 213 public:
196 explicit WebCryptoRsaHashedKeyGenParams(const WebCryptoAlgorithm& hash, unsi gned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExpo nentSize) 214 explicit WebCryptoRsaHashedKeyGenParams(const WebCryptoAlgorithm& hash, unsi gned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExpo nentSize)
197 : m_modulusLengthBits(modulusLengthBits) 215 : WebCryptoRsaKeyGenParams(modulusLengthBits, publicExponent, publicExpo nentSize)
198 , m_publicExponent(publicExponent, publicExponentSize)
199 , m_hash(hash) 216 , m_hash(hash)
200 { 217 {
201 BLINK_ASSERT(!hash.isNull()); 218 BLINK_ASSERT(!hash.isNull());
202 } 219 }
203 220
204 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedKeyGenParams; } 221 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedKeyGenParams; }
205 222
206 unsigned modulusLengthBits() const { return m_modulusLengthBits; }
207 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo nent; }
208 const WebCryptoAlgorithm& hash() const { return m_hash; } 223 const WebCryptoAlgorithm& hash() const { return m_hash; }
209 224
210 private: 225 private:
211 const unsigned m_modulusLengthBits;
212 const WebVector<unsigned char> m_publicExponent;
213 const WebCryptoAlgorithm m_hash; 226 const WebCryptoAlgorithm m_hash;
214 }; 227 };
215 228
216 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams { 229 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams {
217 public: 230 public:
218 WebCryptoRsaOaepParams(bool hasLabel, const unsigned char* label, unsigned l abelSize) 231 WebCryptoRsaOaepParams(bool hasLabel, const unsigned char* label, unsigned l abelSize)
219 : m_hasLabel(hasLabel) 232 : m_hasLabel(hasLabel)
220 , m_optionalLabel(label, labelSize) 233 , m_optionalLabel(label, labelSize)
221 { 234 {
222 BLINK_ASSERT(hasLabel || !labelSize); 235 BLINK_ASSERT(hasLabel || !labelSize);
223 } 236 }
224 237
225 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaOaepParams; } 238 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaOaepParams; }
226 239
227 bool hasLabel() const { return m_hasLabel; } 240 bool hasLabel() const { return m_hasLabel; }
228 const WebVector<unsigned char>& optionalLabel() const { return m_optionalLab el; } 241 const WebVector<unsigned char>& optionalLabel() const { return m_optionalLab el; }
229 242
230 private: 243 private:
231 const bool m_hasLabel; 244 const bool m_hasLabel;
232 const WebVector<unsigned char> m_optionalLabel; 245 const WebVector<unsigned char> m_optionalLabel;
233 }; 246 };
234 247
235 } // namespace blink 248 } // namespace blink
236 249
237 #endif 250 #endif
OLDNEW
« no previous file with comments | « trunk/public/platform/WebCryptoAlgorithm.h ('k') | trunk/public/platform/WebCryptoKeyAlgorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698