OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/renderer/extensions/enterprise_platform_keys_natives.h" | 5 #include "chrome/renderer/extensions/enterprise_platform_keys_natives.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/renderer/extensions/chrome_v8_context.h" | 10 #include "chrome/renderer/extensions/chrome_v8_context.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 if (rsaHashedKeyGen) { | 49 if (rsaHashedKeyGen) { |
50 dict->SetIntegerWithoutPathExpansion("modulusLength", | 50 dict->SetIntegerWithoutPathExpansion("modulusLength", |
51 rsaHashedKeyGen->modulusLengthBits()); | 51 rsaHashedKeyGen->modulusLengthBits()); |
52 const blink::WebVector<unsigned char>& public_exponent = | 52 const blink::WebVector<unsigned char>& public_exponent = |
53 rsaHashedKeyGen->publicExponent(); | 53 rsaHashedKeyGen->publicExponent(); |
54 dict->SetWithoutPathExpansion( | 54 dict->SetWithoutPathExpansion( |
55 "publicExponent", | 55 "publicExponent", |
56 base::BinaryValue::CreateWithCopiedBuffer( | 56 base::BinaryValue::CreateWithCopiedBuffer( |
57 reinterpret_cast<const char*>(public_exponent.data()), | 57 reinterpret_cast<const char*>(public_exponent.data()), |
58 public_exponent.size())); | 58 public_exponent.size())); |
59 | |
60 const blink::WebCryptoAlgorithm& hash = rsaHashedKeyGen->hash(); | |
61 DCHECK(!hash.isNull()); | |
62 const blink::WebCryptoAlgorithmInfo* hash_info = | |
63 blink::WebCryptoAlgorithm::lookupAlgorithmInfo(hash.id()); | |
64 | |
65 scoped_ptr<base::DictionaryValue> hash_dict(new base::DictionaryValue); | |
66 hash_dict->SetStringWithoutPathExpansion("name", hash_info->name); | |
eroman
2014/06/17 18:25:22
isn't there a more direct id to name function? (ra
| |
67 dict->SetWithoutPathExpansion("hash", hash_dict.release()); | |
59 } | 68 } |
60 // Otherwise, |algorithm| is missing support here or no parameters were | 69 // Otherwise, |algorithm| is missing support here or no parameters were |
61 // required. | 70 // required. |
62 return dict.Pass(); | 71 return dict.Pass(); |
63 } | 72 } |
64 | 73 |
65 } // namespace | 74 } // namespace |
66 | 75 |
67 EnterprisePlatformKeysNatives::EnterprisePlatformKeysNatives( | 76 EnterprisePlatformKeysNatives::EnterprisePlatformKeysNatives( |
68 ScriptContext* context) | 77 ScriptContext* context) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 if (!algorithm_dict) | 110 if (!algorithm_dict) |
102 return; | 111 return; |
103 | 112 |
104 scoped_ptr<content::V8ValueConverter> converter( | 113 scoped_ptr<content::V8ValueConverter> converter( |
105 content::V8ValueConverter::create()); | 114 content::V8ValueConverter::create()); |
106 call_info.GetReturnValue().Set( | 115 call_info.GetReturnValue().Set( |
107 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); | 116 converter->ToV8Value(algorithm_dict.get(), context()->v8_context())); |
108 } | 117 } |
109 | 118 |
110 } // namespace extensions | 119 } // namespace extensions |
OLD | NEW |