OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "modules/crypto/KeyAlgorithm.h" | 32 #include "modules/crypto/KeyAlgorithm.h" |
33 | 33 |
34 #include "modules/crypto/AesKeyAlgorithm.h" | 34 #include "modules/crypto/AesKeyAlgorithm.h" |
35 #include "modules/crypto/HmacKeyAlgorithm.h" | 35 #include "modules/crypto/HmacKeyAlgorithm.h" |
36 #include "modules/crypto/NormalizeAlgorithm.h" | 36 #include "modules/crypto/NormalizeAlgorithm.h" |
37 #include "modules/crypto/RsaHashedKeyAlgorithm.h" | 37 #include "modules/crypto/RsaHashedKeyAlgorithm.h" |
38 #include "modules/crypto/RsaKeyAlgorithm.h" | 38 #include "modules/crypto/RsaKeyAlgorithm.h" |
| 39 #include "public/platform/WebCryptoAlgorithm.h" |
39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
40 | 41 |
41 namespace WebCore { | 42 namespace WebCore { |
42 | 43 |
43 KeyAlgorithm::~KeyAlgorithm() | 44 KeyAlgorithm::~KeyAlgorithm() |
44 { | 45 { |
45 } | 46 } |
46 | 47 |
47 KeyAlgorithm* KeyAlgorithm::create(const blink::WebCryptoKeyAlgorithm& algorithm
) | 48 KeyAlgorithm* KeyAlgorithm::create(const blink::WebCryptoKeyAlgorithm& algorithm
) |
48 { | 49 { |
(...skipping 19 matching lines...) Expand all Loading... |
68 } | 69 } |
69 | 70 |
70 KeyAlgorithm::KeyAlgorithm(const blink::WebCryptoKeyAlgorithm& algorithm) | 71 KeyAlgorithm::KeyAlgorithm(const blink::WebCryptoKeyAlgorithm& algorithm) |
71 : m_algorithm(algorithm) | 72 : m_algorithm(algorithm) |
72 { | 73 { |
73 ScriptWrappable::init(this); | 74 ScriptWrappable::init(this); |
74 } | 75 } |
75 | 76 |
76 String KeyAlgorithm::name() | 77 String KeyAlgorithm::name() |
77 { | 78 { |
78 return algorithmIdToName(m_algorithm.id()); | 79 const blink::WebCryptoAlgorithmInfo* info = blink::WebCryptoAlgorithm::looku
pAlgorithmInfo(m_algorithm.id()); |
| 80 return info->name; |
79 } | 81 } |
80 | 82 |
81 bool KeyAlgorithm::isAesKeyAlgorithm() const | 83 bool KeyAlgorithm::isAesKeyAlgorithm() const |
82 { | 84 { |
83 return m_algorithm.paramsType() == blink::WebCryptoKeyAlgorithmParamsTypeAes
; | 85 return m_algorithm.paramsType() == blink::WebCryptoKeyAlgorithmParamsTypeAes
; |
84 } | 86 } |
85 | 87 |
86 bool KeyAlgorithm::isHmacKeyAlgorithm() const | 88 bool KeyAlgorithm::isHmacKeyAlgorithm() const |
87 { | 89 { |
88 return m_algorithm.paramsType() == blink::WebCryptoKeyAlgorithmParamsTypeHma
c; | 90 return m_algorithm.paramsType() == blink::WebCryptoKeyAlgorithmParamsTypeHma
c; |
89 } | 91 } |
90 | 92 |
91 bool KeyAlgorithm::isRsaHashedKeyAlgorithm() const | 93 bool KeyAlgorithm::isRsaHashedKeyAlgorithm() const |
92 { | 94 { |
93 return m_algorithm.paramsType() == blink::WebCryptoKeyAlgorithmParamsTypeRsa
Hashed; | 95 return m_algorithm.paramsType() == blink::WebCryptoKeyAlgorithmParamsTypeRsa
Hashed; |
94 } | 96 } |
95 | 97 |
96 void KeyAlgorithm::trace(Visitor*) | 98 void KeyAlgorithm::trace(Visitor*) |
97 { | 99 { |
98 } | 100 } |
99 | 101 |
100 } // namespace WebCore | 102 } // namespace WebCore |
OLD | NEW |