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