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

Side by Side Diff: content/renderer/webcrypto/webcrypto_impl.cc

Issue 104923004: [webcrypto] Implicitly set public keys to extractable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | content/renderer/webcrypto/webcrypto_impl_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/webcrypto/webcrypto_impl.h" 5 #include "content/renderer/webcrypto/webcrypto_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull(); 208 blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
209 blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull(); 209 blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
210 if (!GenerateKeyPairInternal( 210 if (!GenerateKeyPairInternal(
211 algorithm, extractable, usage_mask, &public_key, &private_key)) { 211 algorithm, extractable, usage_mask, &public_key, &private_key)) {
212 result.completeWithError(); 212 result.completeWithError();
213 } else { 213 } else {
214 DCHECK(public_key.handle()); 214 DCHECK(public_key.handle());
215 DCHECK(private_key.handle()); 215 DCHECK(private_key.handle());
216 DCHECK_EQ(algorithm.id(), public_key.algorithm().id()); 216 DCHECK_EQ(algorithm.id(), public_key.algorithm().id());
217 DCHECK_EQ(algorithm.id(), private_key.algorithm().id()); 217 DCHECK_EQ(algorithm.id(), private_key.algorithm().id());
218 // TODO(padolph): The public key should probably always be extractable, 218 DCHECK_EQ(true, public_key.extractable());
219 // regardless of the input 'extractable' parameter, but that is not called
220 // out in the Web Crypto API spec.
221 // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=23695
222 DCHECK_EQ(extractable, public_key.extractable());
223 DCHECK_EQ(extractable, private_key.extractable()); 219 DCHECK_EQ(extractable, private_key.extractable());
224 DCHECK_EQ(usage_mask, public_key.usages()); 220 DCHECK_EQ(usage_mask, public_key.usages());
225 DCHECK_EQ(usage_mask, private_key.usages()); 221 DCHECK_EQ(usage_mask, private_key.usages());
226 result.completeWithKeyPair(public_key, private_key); 222 result.completeWithKeyPair(public_key, private_key);
227 } 223 }
228 } else { 224 } else {
229 blink::WebCryptoKey key = blink::WebCryptoKey::createNull(); 225 blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
230 if (!GenerateKeyInternal(algorithm, extractable, usage_mask, &key)) { 226 if (!GenerateKeyInternal(algorithm, extractable, usage_mask, &key)) {
231 result.completeWithError(); 227 result.completeWithError();
232 } else { 228 } else {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // TODO(padolph): JWK import RSA public key 581 // TODO(padolph): JWK import RSA public key
586 return false; 582 return false;
587 } else { 583 } else {
588 return false; 584 return false;
589 } 585 }
590 586
591 return true; 587 return true;
592 } 588 }
593 589
594 } // namespace content 590 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/webcrypto/webcrypto_impl_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698