Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 16 matching lines...) Expand all Loading... | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebCryptoAlgorithmParams_h | 31 #ifndef WebCryptoAlgorithmParams_h |
| 32 #define WebCryptoAlgorithmParams_h | 32 #define WebCryptoAlgorithmParams_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebCryptoAlgorithm.h" | 35 #include "WebCryptoAlgorithm.h" |
| 36 #include "WebCryptoKey.h" | 36 #include "WebCryptoKey.h" |
| 37 #include "WebCryptoUtil.h" | |
| 37 #include "WebVector.h" | 38 #include "WebVector.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 // NOTE: For documentation on the meaning of each of the parameters see the | 42 // NOTE: For documentation on the meaning of each of the parameters see the |
| 42 // Web crypto spec: | 43 // Web crypto spec: |
| 43 // | 44 // |
| 44 // http://www.w3.org/TR/WebCryptoAPI | 45 // http://www.w3.org/TR/WebCryptoAPI |
| 45 // | 46 // |
| 46 // For the most part, the parameters in the spec have the same name, | 47 // For the most part, the parameters in the spec have the same name, |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 { | 221 { |
| 221 BLINK_ASSERT(!hash.isNull()); | 222 BLINK_ASSERT(!hash.isNull()); |
| 222 } | 223 } |
| 223 | 224 |
| 224 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedKeyGenParams; } | 225 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeRsaHashedKeyGenParams; } |
| 225 | 226 |
| 226 unsigned modulusLengthBits() const { return m_modulusLengthBits; } | 227 unsigned modulusLengthBits() const { return m_modulusLengthBits; } |
| 227 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo nent; } | 228 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo nent; } |
| 228 const WebCryptoAlgorithm& hash() const { return m_hash; } | 229 const WebCryptoAlgorithm& hash() const { return m_hash; } |
| 229 | 230 |
| 231 // Converts the public exponent (BigInteger) to unsigned int. Returns true o n success (if its value is not too large). | |
| 232 bool publicExponentToUint(unsigned& result) const | |
|
eroman
2015/10/27 18:24:11
I suggest removing this function, and just using W
hbos_chromium
2015/10/28 10:35:05
Done.
| |
| 233 { | |
| 234 return bigIntegerToUint(m_publicExponent, result); | |
| 235 } | |
| 230 private: | 236 private: |
| 231 const unsigned m_modulusLengthBits; | 237 const unsigned m_modulusLengthBits; |
| 232 const WebVector<unsigned char> m_publicExponent; | 238 const WebVector<unsigned char> m_publicExponent; |
| 233 const WebCryptoAlgorithm m_hash; | 239 const WebCryptoAlgorithm m_hash; |
| 234 }; | 240 }; |
| 235 | 241 |
| 236 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams { | 242 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams { |
| 237 public: | 243 public: |
| 238 WebCryptoRsaOaepParams(bool hasLabel, const unsigned char* label, unsigned l abelSize) | 244 WebCryptoRsaOaepParams(bool hasLabel, const unsigned char* label, unsigned l abelSize) |
| 239 : m_hasLabel(hasLabel) | 245 : m_hasLabel(hasLabel) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 unsigned iterations() const { return m_iterations; } | 381 unsigned iterations() const { return m_iterations; } |
| 376 | 382 |
| 377 private: | 383 private: |
| 378 const WebVector<unsigned char> m_salt; | 384 const WebVector<unsigned char> m_salt; |
| 379 const unsigned m_iterations; | 385 const unsigned m_iterations; |
| 380 }; | 386 }; |
| 381 | 387 |
| 382 } // namespace blink | 388 } // namespace blink |
| 383 | 389 |
| 384 #endif | 390 #endif |
| OLD | NEW |