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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return false; | 182 return false; |
183 } | 183 } |
184 | 184 |
185 if (m_key.algorithm().id() != algorithm.id()) { | 185 if (m_key.algorithm().id() != algorithm.id()) { |
186 exceptionState.throwDOMException(NotSupportedError, "key.algorithm does
not match that of operation"); | 186 exceptionState.throwDOMException(NotSupportedError, "key.algorithm does
not match that of operation"); |
187 return false; | 187 return false; |
188 } | 188 } |
189 | 189 |
190 // Verify that the algorithm-specific parameters for the key conform to the | 190 // Verify that the algorithm-specific parameters for the key conform to the |
191 // algorithm. | 191 // algorithm. |
| 192 // FIXME: Verify that this is complete. |
192 | 193 |
193 if (m_key.algorithm().id() == blink::WebCryptoAlgorithmIdHmac) { | 194 if (m_key.algorithm().id() == blink::WebCryptoAlgorithmIdHmac) { |
194 blink::WebCryptoAlgorithmId keyHash; | 195 blink::WebCryptoAlgorithmId keyHash; |
195 blink::WebCryptoAlgorithmId algorithmHash; | 196 blink::WebCryptoAlgorithmId algorithmHash; |
196 if (!getHmacHashId(m_key.algorithm(), keyHash) || !getHmacHashId(algorit
hm, algorithmHash) || keyHash != algorithmHash) { | 197 if (!getHmacHashId(m_key.algorithm(), keyHash) || !getHmacHashId(algorit
hm, algorithmHash) || keyHash != algorithmHash) { |
197 exceptionState.throwDOMException(NotSupportedError, "key.algorithm d
oes not match that of operation (HMAC's hash differs)"); | 198 exceptionState.throwDOMException(NotSupportedError, "key.algorithm d
oes not match that of operation (HMAC's hash differs)"); |
198 return false; | 199 return false; |
199 } | 200 } |
200 } | 201 } |
201 | 202 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 if (!usage) { | 235 if (!usage) { |
235 exceptionState.throwTypeError("Invalid keyUsages argument"); | 236 exceptionState.throwTypeError("Invalid keyUsages argument"); |
236 return false; | 237 return false; |
237 } | 238 } |
238 mask |= usage; | 239 mask |= usage; |
239 } | 240 } |
240 return true; | 241 return true; |
241 } | 242 } |
242 | 243 |
243 } // namespace WebCore | 244 } // namespace WebCore |
OLD | NEW |