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

Side by Side Diff: Source/platform/exported/WebCryptoKeyAlgorithm.cpp

Issue 789733009: Implement HKDF for WebCrypto (blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years 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
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (!WebCryptoAlgorithm::isHash(hash)) 86 if (!WebCryptoAlgorithm::isHash(hash))
87 return WebCryptoKeyAlgorithm(); 87 return WebCryptoKeyAlgorithm();
88 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaHashedKeyAlgorithm Params(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash))) ); 88 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaHashedKeyAlgorithm Params(modulusLengthBits, publicExponent, publicExponentSize, createHash(hash))) );
89 } 89 }
90 90
91 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc(WebCryptoAlgorithmId id, W ebCryptoNamedCurve namedCurve) 91 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc(WebCryptoAlgorithmId id, W ebCryptoNamedCurve namedCurve)
92 { 92 {
93 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoEcKeyAlgorithmParams( namedCurve))); 93 return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoEcKeyAlgorithmParams( namedCurve)));
94 } 94 }
95 95
96 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::create(WebCryptoAlgorithmId id)
eroman 2014/12/23 20:58:24 Call this createHkdf() instead and omit the ID par
nharper 2014/12/23 22:46:59 Done.
97 {
98 return WebCryptoKeyAlgorithm(id, nullptr);
eroman 2014/12/23 20:58:24 We should find out from the working group if this
eroman 2014/12/23 22:03:53 Actually I am fairly confident a "length" attribut
nharper 2014/12/23 22:46:59 PBKDF2 and CONCAT both have no extra params for Ke
eroman 2014/12/23 23:34:29 The other reason HMAC needs it, is HMAC keys are n
99 }
100
96 bool WebCryptoKeyAlgorithm::isNull() const 101 bool WebCryptoKeyAlgorithm::isNull() const
97 { 102 {
98 return m_private.isNull(); 103 return m_private.isNull();
99 } 104 }
100 105
101 WebCryptoAlgorithmId WebCryptoKeyAlgorithm::id() const 106 WebCryptoAlgorithmId WebCryptoKeyAlgorithm::id() const
102 { 107 {
103 ASSERT(!isNull()); 108 ASSERT(!isNull());
104 return m_private->id; 109 return m_private->id;
105 } 110 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 ASSERT(!isNull()); 146 ASSERT(!isNull());
142 if (paramsType() == WebCryptoKeyAlgorithmParamsTypeEc) 147 if (paramsType() == WebCryptoKeyAlgorithmParamsTypeEc)
143 return static_cast<WebCryptoEcKeyAlgorithmParams*>(m_private->params.get ()); 148 return static_cast<WebCryptoEcKeyAlgorithmParams*>(m_private->params.get ());
144 return 0; 149 return 0;
145 } 150 }
146 151
147 void WebCryptoKeyAlgorithm::writeToDictionary(WebCryptoKeyAlgorithmDictionary* d ict) const 152 void WebCryptoKeyAlgorithm::writeToDictionary(WebCryptoKeyAlgorithmDictionary* d ict) const
148 { 153 {
149 ASSERT(!isNull()); 154 ASSERT(!isNull());
150 dict->setString("name", WebCryptoAlgorithm::lookupAlgorithmInfo(id())->name) ; 155 dict->setString("name", WebCryptoAlgorithm::lookupAlgorithmInfo(id())->name) ;
151 m_private->params.get()->writeToDictionary(dict); 156 if (m_private->params.get())
157 m_private->params.get()->writeToDictionary(dict);
152 } 158 }
153 159
154 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other) 160 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other)
155 { 161 {
156 m_private = other.m_private; 162 m_private = other.m_private;
157 } 163 }
158 164
159 void WebCryptoKeyAlgorithm::reset() 165 void WebCryptoKeyAlgorithm::reset()
160 { 166 {
161 m_private.reset(); 167 m_private.reset();
162 } 168 }
163 169
164 } // namespace blink 170 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698