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

Side by Side Diff: Source/modules/crypto/Key.cpp

Issue 109223002: [webcrypto] Add crypto.subtle.wrapKey() and crypto.subtle.unwrapKey() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase test expectations (to match latest changes I had made) Created 7 years 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « LayoutTests/crypto/wrap-unwrap-expected.txt ('k') | Source/modules/crypto/NormalizeAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698