OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <cryptohi.h> | 7 #include <cryptohi.h> |
8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
9 #include <sechash.h> | 9 #include <sechash.h> |
10 | 10 |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 &rsa_gen_params, | 748 &rsa_gen_params, |
749 &sec_public_key, | 749 &sec_public_key, |
750 attribute_flags, | 750 attribute_flags, |
751 operation_flags, | 751 operation_flags, |
752 operation_flags_mask, | 752 operation_flags_mask, |
753 NULL)); | 753 NULL)); |
754 if (!private_key) { | 754 if (!private_key) { |
755 return false; | 755 return false; |
756 } | 756 } |
757 | 757 |
758 // One extractable input parameter is provided, and the Web Crypto API | |
759 // spec at this time says it applies to both members of the key pair. | |
760 // This is probably not correct: it makes more operational sense to have | |
761 // extractable apply only to the private key and make the public key | |
762 // always extractable. For now implement what the spec says and track the | |
763 // spec bug here: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23695 | |
764 *public_key = blink::WebCryptoKey::create( | 758 *public_key = blink::WebCryptoKey::create( |
765 new PublicKeyHandle(crypto::ScopedSECKEYPublicKey(sec_public_key)), | 759 new PublicKeyHandle(crypto::ScopedSECKEYPublicKey(sec_public_key)), |
766 blink::WebCryptoKeyTypePublic, | 760 blink::WebCryptoKeyTypePublic, |
767 extractable, // probably should be 'true' always | 761 true, |
768 algorithm, | 762 algorithm, |
769 usage_mask); | 763 usage_mask); |
770 *private_key = blink::WebCryptoKey::create( | 764 *private_key = blink::WebCryptoKey::create( |
771 new PrivateKeyHandle(scoped_sec_private_key.Pass()), | 765 new PrivateKeyHandle(scoped_sec_private_key.Pass()), |
772 blink::WebCryptoKeyTypePrivate, | 766 blink::WebCryptoKeyTypePrivate, |
773 extractable, | 767 extractable, |
774 algorithm, | 768 algorithm, |
775 usage_mask); | 769 usage_mask); |
776 | 770 |
777 return true; | 771 return true; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 break; | 924 break; |
931 } | 925 } |
932 default: | 926 default: |
933 return false; | 927 return false; |
934 } | 928 } |
935 | 929 |
936 return true; | 930 return true; |
937 } | 931 } |
938 | 932 |
939 } // namespace content | 933 } // namespace content |
OLD | NEW |