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

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

Issue 312393004: Expose WebCrypto's lookupAlgorithmInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@share_normalize
Patch Set: Addressed comment (removed redundant idToName). Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/modules/crypto/NormalizeAlgorithm.h » ('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) 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
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/modules/crypto/NormalizeAlgorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698