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 20 matching lines...) Expand all Loading... |
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/HmacKeyParams.h" | 36 #include "modules/crypto/HmacKeyParams.h" |
37 #include "modules/crypto/HmacParams.h" | 37 #include "modules/crypto/HmacParams.h" |
38 #include "modules/crypto/NormalizeAlgorithm.h" | 38 #include "modules/crypto/NormalizeAlgorithm.h" |
39 #include "modules/crypto/RsaKeyGenParams.h" | 39 #include "modules/crypto/RsaKeyGenParams.h" |
40 #include "modules/crypto/RsaSsaParams.h" | 40 #include "modules/crypto/RsaSsaParams.h" |
| 41 #include "platform/NotImplemented.h" |
41 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
42 | 43 |
43 namespace WebCore { | 44 namespace WebCore { |
44 | 45 |
45 PassRefPtr<Algorithm> Algorithm::create(const WebKit::WebCryptoAlgorithm& algori
thm) | 46 PassRefPtr<Algorithm> Algorithm::create(const WebKit::WebCryptoAlgorithm& algori
thm) |
46 { | 47 { |
47 switch (algorithm.paramsType()) { | 48 switch (algorithm.paramsType()) { |
48 case WebKit::WebCryptoAlgorithmParamsTypeNone: | 49 case WebKit::WebCryptoAlgorithmParamsTypeNone: |
49 return adoptRef(new Algorithm(algorithm)); | 50 return adoptRef(new Algorithm(algorithm)); |
50 case WebKit::WebCryptoAlgorithmParamsTypeAesCbcParams: | 51 case WebKit::WebCryptoAlgorithmParamsTypeAesCbcParams: |
51 return AesCbcParams::create(algorithm); | 52 return AesCbcParams::create(algorithm); |
52 case WebKit::WebCryptoAlgorithmParamsTypeAesKeyGenParams: | 53 case WebKit::WebCryptoAlgorithmParamsTypeAesKeyGenParams: |
53 return AesKeyGenParams::create(algorithm); | 54 return AesKeyGenParams::create(algorithm); |
54 case WebKit::WebCryptoAlgorithmParamsTypeHmacParams: | 55 case WebKit::WebCryptoAlgorithmParamsTypeHmacParams: |
55 return HmacParams::create(algorithm); | 56 return HmacParams::create(algorithm); |
56 case WebKit::WebCryptoAlgorithmParamsTypeHmacKeyParams: | 57 case WebKit::WebCryptoAlgorithmParamsTypeHmacKeyParams: |
57 return HmacKeyParams::create(algorithm); | 58 return HmacKeyParams::create(algorithm); |
58 case WebKit::WebCryptoAlgorithmParamsTypeRsaSsaParams: | 59 case WebKit::WebCryptoAlgorithmParamsTypeRsaSsaParams: |
59 return RsaSsaParams::create(algorithm); | 60 return RsaSsaParams::create(algorithm); |
60 case WebKit::WebCryptoAlgorithmParamsTypeRsaKeyGenParams: | 61 case WebKit::WebCryptoAlgorithmParamsTypeRsaKeyGenParams: |
61 return RsaKeyGenParams::create(algorithm); | 62 return RsaKeyGenParams::create(algorithm); |
| 63 case WebKit::WebCryptoAlgorithmParamsTypeAesGcmParams: |
| 64 case WebKit::WebCryptoAlgorithmParamsTypeRsaOaepParams: |
| 65 // TODO |
| 66 notImplemented(); |
| 67 break; |
62 } | 68 } |
63 ASSERT_NOT_REACHED(); | 69 ASSERT_NOT_REACHED(); |
64 return 0; | 70 return 0; |
65 } | 71 } |
66 | 72 |
67 Algorithm::Algorithm(const WebKit::WebCryptoAlgorithm& algorithm) | 73 Algorithm::Algorithm(const WebKit::WebCryptoAlgorithm& algorithm) |
68 : m_algorithm(algorithm) | 74 : m_algorithm(algorithm) |
69 { | 75 { |
70 ScriptWrappable::init(this); | 76 ScriptWrappable::init(this); |
71 } | 77 } |
72 | 78 |
73 String Algorithm::name() | 79 String Algorithm::name() |
74 { | 80 { |
75 return algorithmIdToName(m_algorithm.id()); | 81 return algorithmIdToName(m_algorithm.id()); |
76 } | 82 } |
77 | 83 |
78 } // namespace WebCore | 84 } // namespace WebCore |
OLD | NEW |