Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(967)

Side by Side Diff: Source/modules/crypto/Algorithm.cpp

Issue 21759002: WebCrypto: Add algorithm normalization rules for RSASSA-PKCS1-v1_5. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase onto master Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/crypto/AesKeyGenParams.cpp ('k') | Source/modules/crypto/HmacParams.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/modules/crypto/AesKeyGenParams.cpp ('k') | Source/modules/crypto/HmacParams.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698