OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "modules/crypto/Algorithm.h" | 32 #include "modules/crypto/Algorithm.h" |
33 | 33 |
34 #include "modules/crypto/AesCbcParams.h" | 34 #include "modules/crypto/AesCbcParams.h" |
35 #include "modules/crypto/AesKeyGenParams.h" | 35 #include "modules/crypto/AesKeyGenParams.h" |
36 #include "modules/crypto/HmacParams.h" | 36 #include "modules/crypto/HmacParams.h" |
| 37 #include "modules/crypto/RsaKeyGenParams.h" |
| 38 #include "modules/crypto/RsaSsaParams.h" |
37 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
38 | 40 |
39 namespace WebCore { | 41 namespace WebCore { |
40 | 42 |
41 PassRefPtr<Algorithm> Algorithm::create(const WebKit::WebCryptoAlgorithm& algori
thm) | 43 PassRefPtr<Algorithm> Algorithm::create(const WebKit::WebCryptoAlgorithm& algori
thm) |
42 { | 44 { |
43 switch (algorithm.paramsType()) { | 45 switch (algorithm.paramsType()) { |
44 case WebKit::WebCryptoAlgorithmParamsTypeNone: | 46 case WebKit::WebCryptoAlgorithmParamsTypeNone: |
45 return adoptRef(new Algorithm(algorithm)); | 47 return adoptRef(new Algorithm(algorithm)); |
46 case WebKit::WebCryptoAlgorithmParamsTypeAesCbcParams: | 48 case WebKit::WebCryptoAlgorithmParamsTypeAesCbcParams: |
47 return AesCbcParams::create(algorithm); | 49 return AesCbcParams::create(algorithm); |
48 case WebKit::WebCryptoAlgorithmParamsTypeAesKeyGenParams: | 50 case WebKit::WebCryptoAlgorithmParamsTypeAesKeyGenParams: |
49 return AesKeyGenParams::create(algorithm); | 51 return AesKeyGenParams::create(algorithm); |
50 case WebKit::WebCryptoAlgorithmParamsTypeHmacParams: | 52 case WebKit::WebCryptoAlgorithmParamsTypeHmacParams: |
51 return HmacParams::create(algorithm); | 53 return HmacParams::create(algorithm); |
| 54 case WebKit::WebCryptoAlgorithmParamsTypeRsaSsaParams: |
| 55 return RsaSsaParams::create(algorithm); |
| 56 case WebKit::WebCryptoAlgorithmParamsTypeRsaKeyGenParams: |
| 57 return RsaKeyGenParams::create(algorithm); |
52 } | 58 } |
53 ASSERT_NOT_REACHED(); | 59 ASSERT_NOT_REACHED(); |
54 return 0; | 60 return 0; |
55 } | 61 } |
56 | 62 |
57 Algorithm::Algorithm(const WebKit::WebCryptoAlgorithm& algorithm) | 63 Algorithm::Algorithm(const WebKit::WebCryptoAlgorithm& algorithm) |
58 : m_algorithm(algorithm) | 64 : m_algorithm(algorithm) |
59 { | 65 { |
60 ScriptWrappable::init(this); | 66 ScriptWrappable::init(this); |
61 } | 67 } |
62 | 68 |
63 String Algorithm::name() | 69 String Algorithm::name() |
64 { | 70 { |
65 return ASCIILiteral(m_algorithm.name()); | 71 return ASCIILiteral(m_algorithm.name()); |
66 } | 72 } |
67 | 73 |
68 } // namespace WebCore | 74 } // namespace WebCore |
OLD | NEW |